Rev | Line | |
---|
[483] | 1 | define([ |
---|
| 2 | "dojo/_base/declare", |
---|
| 3 | "dojo/_base/lang", |
---|
| 4 | "dojo/has" |
---|
| 5 | ], function(declare, lang, has){ |
---|
| 6 | has.add("dom-qsa", !!document.createElement("div").querySelectorAll); |
---|
| 7 | |
---|
| 8 | return declare("dojox.mvc._InlineTemplateMixin", null, { |
---|
| 9 | // summary: |
---|
| 10 | // A mixin for template widget, which will look for `<script type="dojox/mvc/InlineTemplate">` |
---|
| 11 | // and treat the HTML in there as the template string. |
---|
| 12 | |
---|
| 13 | buildRendering: function(){ |
---|
| 14 | var root = this.srcNodeRef; |
---|
| 15 | if(root){ |
---|
| 16 | var nodes = has("dom-qsa") ? root.querySelectorAll("script[type='dojox/mvc/InlineTemplate']") : root.getElementsByTagName("script"), |
---|
| 17 | templates = []; |
---|
| 18 | for(var i = 0, l = nodes.length; i < l; ++i){ |
---|
| 19 | if(!has("dom-qsa") && nodes[i].getAttribute("type") != "dojox/mvc/InlineTemplate"){ continue; } |
---|
| 20 | templates.push(nodes[i].innerHTML); |
---|
| 21 | } |
---|
| 22 | var templateString = lang.trim(templates.join("")); |
---|
| 23 | if(templateString){ |
---|
| 24 | this.templateString = templateString; |
---|
| 25 | } |
---|
| 26 | } |
---|
| 27 | this.inherited(arguments); |
---|
| 28 | } |
---|
| 29 | }); |
---|
| 30 | }); |
---|
Note: See
TracBrowser
for help on using the repository browser.