source: Dev/trunk/src/client/dojox/dtl/ext-dojo/NodeList.js

Last change on this file was 483, checked in by hendrikvanantwerpen, 11 years ago

Added Dojo 1.9.3 release.

  • Property svn:executable set to *
File size: 1003 bytes
Line 
1define([
2        "dojo/_base/lang",
3        "dojo/query",
4        "../_base"
5], function(lang, query, dd){
6        var nl = lang.getObject("dojox.dtl.ext-dojo.NodeList", true);
7
8        var NodeList = query.NodeList;
9
10        lang.extend(NodeList, {
11                dtl: function(template, context){
12                        // summary:
13                        //              Renders the specified template in each of the NodeList entries.
14                        // template: dojox/dtl/__StringArgs|String
15                        //              The template string or location
16                        // context: dojox/dtl/__ObjectArgs|Object
17                        //              The context object or location
18                        var d = dd, self = this;
19                       
20                        var render = function(template, context){
21                                var content = template.render(new d._Context(context));
22                                self.forEach(function(node){
23                                        node.innerHTML = content;
24                                });
25                        };
26
27                        d.text._resolveTemplateArg(template).addCallback(function(templateString){
28                                template = new d.Template(templateString);
29                                d.text._resolveContextArg(context).addCallback(function(context){
30                                        render(template, context);
31                                });
32                        });
33
34                        return this;
35                }
36        });
37        return NodeList;
38});
Note: See TracBrowser for help on using the repository browser.