diff options
author | Richard Beales <[email protected]> | 2013-03-18 07:32:01 +0000 |
---|---|---|
committer | Richard Beales <[email protected]> | 2013-03-18 07:32:01 +0000 |
commit | 7c97d17aaf373339a8bcd917ad59ca6018148f0d (patch) | |
tree | 5a3c04f0f9529be392c1263d3feb75806eb43797 /lib/dojo/NodeList-html.js.uncompressed.js | |
parent | 70db7424e7068701e60cc5bcdfe8f858be508179 (diff) | |
parent | c670a80ddd9b03bd4ea6d940a9ed682fd26248d7 (diff) |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'lib/dojo/NodeList-html.js.uncompressed.js')
-rw-r--r-- | lib/dojo/NodeList-html.js.uncompressed.js | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/lib/dojo/NodeList-html.js.uncompressed.js b/lib/dojo/NodeList-html.js.uncompressed.js new file mode 100644 index 000000000..4348f6df7 --- /dev/null +++ b/lib/dojo/NodeList-html.js.uncompressed.js @@ -0,0 +1,53 @@ +define("dojo/NodeList-html", ["./query", "./_base/lang", "./html"], function(query, lang, html){ + +// module: +// dojo/NodeList-html + +/*===== +return function(){ + // summary: + // Adds a chainable html method to dojo.query() / NodeList instances for setting/replacing node content +}; +=====*/ + +var NodeList = query.NodeList; + + +lang.extend(NodeList, { + html: function(/* String|DomNode|NodeList? */ content, /* Object? */params){ + // summary: + // see `dojo/html.set()`. Set the content of all elements of this NodeList + // + // content: + // An html string, node or enumerable list of nodes for insertion into the dom + // + // params: + // Optional flags/properties to configure the content-setting. See dojo/html._ContentSetter + // + // description: + // Based around `dojo/html.set()`, set the content of the Elements in a + // NodeList to the given content (string/node/nodelist), with optional arguments + // to further tune the set content behavior. + // + // example: + // | 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>", + // | { + // | parseContent: true, + // | onBegin: function(){ + // | this.content = this.content.replace(/([0-9])/g, this.id + ": $1"); + // | this.inherited("onBegin", arguments); + // | } + // | }).removeClass("notdone").addClass("done"); + + var dhs = new html._ContentSetter(params || {}); + this.forEach(function(elm){ + dhs.node = elm; + dhs.set(content); + dhs.tearDown(); + }); + return this; // dojo/NodeList + } +}); + +return NodeList; +}); |