summaryrefslogtreecommitdiff
path: root/lib/dojo/NodeList-html.js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2011-03-04 19:02:28 +0300
committerAndrew Dolgov <[email protected]>2011-03-04 19:02:59 +0300
commita089699c8915636ba4f158d77dba9b012bc93208 (patch)
treeb2d7d051f1f55d44a6be07d3ee137e5a7ccfcefb /lib/dojo/NodeList-html.js
parentcfad9259a6feacfa8194b1312770ae6db1ecce50 (diff)
build custom layer of Dojo to speed up loading of tt-rss (refs #293)
Diffstat (limited to 'lib/dojo/NodeList-html.js')
-rw-r--r--lib/dojo/NodeList-html.js48
1 files changed, 38 insertions, 10 deletions
diff --git a/lib/dojo/NodeList-html.js b/lib/dojo/NodeList-html.js
index ccc6f10ae..e8e0ac220 100644
--- a/lib/dojo/NodeList-html.js
+++ b/lib/dojo/NodeList-html.js
@@ -5,17 +5,45 @@
*/
-if(!dojo._hasResource["dojo.NodeList-html"]){
-dojo._hasResource["dojo.NodeList-html"]=true;
+if(!dojo._hasResource["dojo.NodeList-html"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojo.NodeList-html"] = true;
dojo.provide("dojo.NodeList-html");
dojo.require("dojo.html");
-dojo.extend(dojo.NodeList,{html:function(_1,_2){
-var _3=new dojo.html._ContentSetter(_2||{});
-this.forEach(function(_4){
-_3.node=_4;
-_3.set(_1);
-_3.tearDown();
+
+/*=====
+dojo["NodeList-html"] = {
+ // summary: Adds a chainable html method to dojo.query() / Nodelist instances for setting/replacing node content
+};
+=====*/
+
+dojo.extend(dojo.NodeList, {
+ html: function(content, /* Object? */params){
+ // summary:
+ // see `dojo.html.set()`. Set the content of all elements of this NodeList
+ //
+ // 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:
+ // | dojo.query(".thingList").html("<li dojoType='dojo.dnd.Moveable'>1</li><li dojoType='dojo.dnd.Moveable'>2</li><li dojoType='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 dojo.html._ContentSetter(params || {});
+ this.forEach(function(elm){
+ dhs.node = elm;
+ dhs.set(content);
+ dhs.tearDown();
+ });
+ return this; // dojo.NodeList
+ }
});
-return this;
-}});
+
}