summaryrefslogtreecommitdiff
path: root/js/dojo-1.6/dojox/dtl/ext-dojo/NodeList.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/dojo-1.6/dojox/dtl/ext-dojo/NodeList.js')
-rw-r--r--js/dojo-1.6/dojox/dtl/ext-dojo/NodeList.js40
1 files changed, 40 insertions, 0 deletions
diff --git a/js/dojo-1.6/dojox/dtl/ext-dojo/NodeList.js b/js/dojo-1.6/dojox/dtl/ext-dojo/NodeList.js
new file mode 100644
index 0000000..e4e78ed
--- /dev/null
+++ b/js/dojo-1.6/dojox/dtl/ext-dojo/NodeList.js
@@ -0,0 +1,40 @@
+/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojox.dtl.ext-dojo.NodeList"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.dtl.ext-dojo.NodeList"] = true;
+dojo.provide("dojox.dtl.ext-dojo.NodeList");
+dojo.require("dojox.dtl._base");
+
+dojo.extend(dojo.NodeList, {
+ dtl: function(template, context){
+ // template: dojox.dtl.__StringArgs|String
+ // The template string or location
+ // context: dojox.dtl.__ObjectArgs|Object
+ // The context object or location
+ var d = dojox.dtl;
+
+ var self = this;
+ var render = function(template, context){
+ var content = template.render(new d._Context(context));
+ self.forEach(function(node){
+ node.innerHTML = content;
+ });
+ }
+
+ d.text._resolveTemplateArg(template).addCallback(function(templateString){
+ template = new d.Template(templateString);
+ d.text._resolveContextArg(context).addCallback(function(context){
+ render(template, context);
+ });
+ });
+
+ return this;
+ }
+});
+
+}