root / trunk / web / dojo / dijit / Declaration.js
History | View | Annotate | Download (1.63 KB)
1 | 9 | andrej.cim | /*
|
---|---|---|---|
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["dijit.Declaration"]){ |
||
9 | dojo._hasResource["dijit.Declaration"]=true; |
||
10 | dojo.provide("dijit.Declaration");
|
||
11 | dojo.require("dijit._Widget");
|
||
12 | dojo.require("dijit._Templated");
|
||
13 | dojo.declare("dijit.Declaration",dijit._Widget,{_noScript:true,widgetClass:"",defaults:null,mixins:[],buildRendering:function(){ |
||
14 | var _1=this.srcNodeRef.parentNode.removeChild(this.srcNodeRef),_2=dojo.query("> script[type^='dojo/method'][event]",_1).orphan(),_3=dojo.query("> script[type^='dojo/method']",_1).orphan(),_4=dojo.query("> script[type^='dojo/connect']",_1).orphan(),_5=_1.nodeName; |
||
15 | var _6=this.defaults||{}; |
||
16 | dojo.forEach(_2,function(s){
|
||
17 | var _7=s.getAttribute("event"),_8=dojo.parser._functionFromScript(s); |
||
18 | _6[_7]=_8; |
||
19 | }); |
||
20 | this.mixins=this.mixins.length?dojo.map(this.mixins,function(_9){ |
||
21 | return dojo.getObject(_9);
|
||
22 | }):[dijit._Widget,dijit._Templated]; |
||
23 | _6.widgetsInTemplate=true;
|
||
24 | _6._skipNodeCache=true;
|
||
25 | _6.templateString="<"+_5+" class='"+_1.className+"' dojoAttachPoint='"+(_1.getAttribute("dojoAttachPoint")||"")+"' dojoAttachEvent='"+(_1.getAttribute("dojoAttachEvent")||"")+"' >"+_1.innerHTML.replace(/\%7B/g,"{").replace(/\%7D/g,"}")+"</"+_5+">"; |
||
26 | dojo.query("[dojoType]",_1).forEach(function(_a){ |
||
27 | _a.removeAttribute("dojoType");
|
||
28 | }); |
||
29 | var wc=dojo.declare(this.widgetClass,this.mixins,_6); |
||
30 | var _b=_4.concat(_3);
|
||
31 | dojo.forEach(_b,function(s){
|
||
32 | var _c=s.getAttribute("event")||"postscript",_d=dojo.parser._functionFromScript(s); |
||
33 | dojo.connect(wc.prototype,_c,_d); |
||
34 | }); |
||
35 | }}); |
||
36 | } |