summaryrefslogtreecommitdiff
path: root/js/dojo/dojox/dtl/Inline.js
blob: 56b1d0519575ea6c3b6883ad8a3801982ee2355f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//>>built
define("dojox/dtl/Inline", [
	"dojo/_base/lang",
	"./_base",
	"dijit/_WidgetBase",
	"dojo/query" // dojo.query
], function(lang,dd,Widget,Query){
	/*=====
		Widget = dijit._WidgetBase;
		Query = dojo.query;
		dd = dojox.dtl;
	=====*/ 
	dd.Inline = lang.extend(function(args, node){
		this.create(args, node);
	},
	Widget.prototype,
	{
		context: null,
		render: function(/*Object|dojox.dtl.Context?*/ context){
			this.context = context || this.context;
			this.postMixInProperties();
			Query("*", this.domNode).orphan();
			this.domNode.innerHTML = this.template.render(this.context);
		},
		declaredClass: "dojox.dtl.Inline",
		buildRendering: function(){
			var div = this.domNode = document.createElement("div");
			var node = this.srcNodeRef;
			if(node.parentNode){
				node.parentNode.replaceChild(div, node);
			}

			this.template = new dd.Template(lang.trim(node.text), true);
			this.render();
		},
		postMixInProperties: function(){
			this.context = (this.context.get === dd._Context.prototype.get) ? this.context : new dd._Context(this.context);
		}
	});
	return dojox.dtl.Inline;
});