| 1 |
define([ |
| 2 |
"dojo/_base/lang", |
| 3 |
"./dom", |
| 4 |
"./_base", |
| 5 |
"dijit/_WidgetBase" |
| 6 |
], function(lang,ddd,dd,Widget){ |
| 7 |
|
| 8 |
return dd.DomInline = lang.extend(function(args, node){ |
| 9 |
this.create(args, node); |
| 10 |
}, |
| 11 |
Widget.prototype, |
| 12 |
{ |
| 13 |
context: null, |
| 14 |
render: function( context){ |
| 15 |
this.context = context || this.context; |
| 16 |
this.postMixInProperties(); |
| 17 |
var root = this.template.render(this.context).getRootNode(); |
| 18 |
if(root != this.containerNode){ |
| 19 |
this.containerNode.parentNode.replaceChild(root, this.containerNode); |
| 20 |
this.containerNode = root; |
| 21 |
} |
| 22 |
}, |
| 23 |
declaredClass: "dojox.dtl.Inline", |
| 24 |
buildRendering: function(){ |
| 25 |
var div = this.domNode = document.createElement("div"); |
| 26 |
this.containerNode = div.appendChild(document.createElement("div")); |
| 27 |
var node = this.srcNodeRef; |
| 28 |
if(node.parentNode){ |
| 29 |
node.parentNode.replaceChild(div, node); |
| 30 |
} |
| 31 |
|
| 32 |
this.template = new dojox.dtl.DomTemplate(lang.trim(node.text), true); |
| 33 |
this.render(); |
| 34 |
}, |
| 35 |
postMixInProperties: function(){ |
| 36 |
this.context = (this.context.get === dojox.dtl._Context.prototype.get) ? this.context : new dojox.dtl.Context(this.context); |
| 37 |
} |
| 38 |
}); |
| 39 |
}); |