]> git.wh0rd.org Git - tt-rss.git/blob - lib/dojo/NodeList-html.js.uncompressed.js
4348f6df7cf9dec8b7ed45dcfbb6d2c62904f8e2
[tt-rss.git] / lib / dojo / NodeList-html.js.uncompressed.js
1 define("dojo/NodeList-html", ["./query", "./_base/lang", "./html"], function(query, lang, html){
2
3 // module:
4 //              dojo/NodeList-html
5
6 /*=====
7 return function(){
8         // summary:
9         //              Adds a chainable html method to dojo.query() / NodeList instances for setting/replacing node content
10 };
11 =====*/
12
13 var NodeList = query.NodeList;
14
15
16 lang.extend(NodeList, {
17         html: function(/* String|DomNode|NodeList? */ content, /* Object? */params){
18                 // summary:
19                 //              see `dojo/html.set()`. Set the content of all elements of this NodeList
20                 //
21                 // content:
22                 //              An html string, node or enumerable list of nodes for insertion into the dom
23                 //
24                 // params:
25                 //              Optional flags/properties to configure the content-setting. See dojo/html._ContentSetter
26                 //
27                 // description:
28                 //              Based around `dojo/html.set()`, set the content of the Elements in a
29                 //              NodeList to the given content (string/node/nodelist), with optional arguments
30                 //              to further tune the set content behavior.
31                 //
32                 // example:
33                 //      | query(".thingList").html("<li data-dojo-type='dojo/dnd/Moveable'>1</li><li data-dojo-type='dojo/dnd/Moveable'>2</li><li data-dojo-type='dojo/dnd/Moveable'>3</li>",
34                 //      | {
35                 //      |       parseContent: true,
36                 //      |       onBegin: function(){
37                 //      |               this.content = this.content.replace(/([0-9])/g, this.id + ": $1");
38                 //      |               this.inherited("onBegin", arguments);
39                 //      |       }
40                 //      | }).removeClass("notdone").addClass("done");
41
42                 var dhs = new html._ContentSetter(params || {});
43                 this.forEach(function(elm){
44                         dhs.node = elm;
45                         dhs.set(content);
46                         dhs.tearDown();
47                 });
48                 return this; // dojo/NodeList
49         }
50 });
51
52 return NodeList;
53 });