Project

General

Profile

Statistics
| Revision:

root / trunk / web / dojo / dojox / dtl / render / dom.js @ 10

History | View | Annotate | Download (1023 Bytes)

1
/*
2
        Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
3
        Available via Academic Free License >= 2.1 OR the modified BSD license.
4
        see: http://dojotoolkit.org/license for details
5
*/
6

    
7

    
8
if(!dojo._hasResource["dojox.dtl.render.dom"]){
9
dojo._hasResource["dojox.dtl.render.dom"]=true;
10
dojo.provide("dojox.dtl.render.dom");
11
dojo.require("dojox.dtl.Context");
12
dojo.require("dojox.dtl.dom");
13
dojox.dtl.render.dom.Render=function(_1,_2){
14
this._tpl=_2;
15
this.domNode=dojo.byId(_1);
16
};
17
dojo.extend(dojox.dtl.render.dom.Render,{setAttachPoint:function(_3){
18
this.domNode=_3;
19
},render:function(_4,_5,_6){
20
if(!this.domNode){
21
throw new Error("You cannot use the Render object without specifying where you want to render it");
22
}
23
this._tpl=_5=_5||this._tpl;
24
_6=_6||_5.getBuffer();
25
_4=_4||new dojox.dtl.Context();
26
var _7=_5.render(_4,_6).getParent();
27
if(!_7){
28
throw new Error("Rendered template does not have a root node");
29
}
30
if(this.domNode!==_7){
31
this.domNode.parentNode.replaceChild(_7,this.domNode);
32
this.domNode=_7;
33
}
34
}});
35
}