diff options
author | Andrew Dolgov <[email protected]> | 2012-08-14 18:59:10 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2012-08-14 18:59:18 +0400 |
commit | 1354d17270961fff662d40f90521223f8fd0d73b (patch) | |
tree | e9266be71587e47c800303446e968a6d3565e2cf /lib/dijit/Declaration.js | |
parent | d04f8c826f5283765f52cf6b98b42a1ed8f2d6bc (diff) |
update dojo to 1.7.3
Diffstat (limited to 'lib/dijit/Declaration.js')
-rw-r--r-- | lib/dijit/Declaration.js | 108 |
1 files changed, 2 insertions, 106 deletions
diff --git a/lib/dijit/Declaration.js b/lib/dijit/Declaration.js index 1cfa8ecad..833489d99 100644 --- a/lib/dijit/Declaration.js +++ b/lib/dijit/Declaration.js @@ -1,106 +1,2 @@ -/* - Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved. - Available via Academic Free License >= 2.1 OR the modified BSD license. - see: http://dojotoolkit.org/license for details -*/ - - -if(!dojo._hasResource["dijit.Declaration"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. -dojo._hasResource["dijit.Declaration"] = true; -dojo.provide("dijit.Declaration"); -dojo.require("dijit._Widget"); -dojo.require("dijit._Templated"); - - -dojo.declare( - "dijit.Declaration", - dijit._Widget, - { - // summary: - // The Declaration widget allows a developer to declare new widget - // classes directly from a snippet of markup. - - // _noScript: [private] Boolean - // Flag to parser to leave alone the script tags contained inside of me - _noScript: true, - - // stopParser: [private] Boolean - // Flag to parser to not try and parse widgets declared inside of me - stopParser: true, - - // widgetClass: [const] String - // Name of class being declared, ex: "acme.myWidget" - widgetClass: "", - - // propList: [const] Object - // Set of attributes for this widget along with default values, ex: - // {delay: 100, title: "hello world"} - defaults: null, - - // mixins: [const] String[] - // List containing the prototype for this widget, and also any mixins, - // ex: ["dijit._Widget", "dijit._Container"] - mixins: [], - - buildRendering: function(){ - var src = this.srcNodeRef.parentNode.removeChild(this.srcNodeRef), - methods = dojo.query("> script[type^='dojo/method']", src).orphan(), - connects = dojo.query("> script[type^='dojo/connect']", src).orphan(), - srcType = src.nodeName; - - var propList = this.defaults || {}; - - // For all methods defined like <script type="dojo/method" data-dojo-event="foo">, - // add that method to prototype. - // If there's no "event" specified then it's code to run on instantiation, - // so it becomes a connection to "postscript" (handled below). - dojo.forEach(methods, function(s){ - var evt = s.getAttribute("event") || s.getAttribute("data-dojo-event"), - func = dojo.parser._functionFromScript(s); - if(evt){ - propList[evt] = func; - }else{ - connects.push(s); - } - }); - - // map array of strings like [ "dijit.form.Button" ] to array of mixin objects - // (note that dojo.map(this.mixins, dojo.getObject) doesn't work because it passes - // a bogus third argument to getObject(), confusing it) - this.mixins = this.mixins.length ? - dojo.map(this.mixins, function(name){ return dojo.getObject(name); } ) : - [ dijit._Widget, dijit._Templated ]; - - propList.widgetsInTemplate = true; - propList._skipNodeCache = true; - propList.templateString = "<"+srcType+" class='"+src.className+"' dojoAttachPoint='"+(src.getAttribute("dojoAttachPoint") || '')+"' dojoAttachEvent='"+(src.getAttribute("dojoAttachEvent") || '')+"' >"+src.innerHTML.replace(/\%7B/g,"{").replace(/\%7D/g,"}")+"</"+srcType+">"; - - // strip things so we don't create stuff under us in the initial setup phase - dojo.query("[dojoType]", src).forEach(function(node){ - node.removeAttribute("dojoType"); - }); - - // create the new widget class - var wc = dojo.declare( - this.widgetClass, - this.mixins, - propList - ); - - // Handle <script> blocks of form: - // <script type="dojo/connect" data-dojo-event="foo"> - // and - // <script type="dojo/method"> - // (Note that the second one is just shorthand for a dojo/connect to postscript) - // Since this is a connect in the declaration, we are actually connection to the method - // in the _prototype_. - dojo.forEach(connects, function(s){ - var evt = s.getAttribute("event") || s.getAttribute("data-dojo-event") || "postscript", - func = dojo.parser._functionFromScript(s); - dojo.connect(wc.prototype, evt, func); - }); - } - } -); - -} +//>>built +define("dijit/Declaration",["dojo/_base/array","dojo/_base/connect","dojo/_base/declare","dojo/_base/lang","dojo/parser","dojo/query","./_Widget","./_TemplatedMixin","./_WidgetsInTemplateMixin","dojo/NodeList-dom"],function(_1,_2,_3,_4,_5,_6,_7,_8,_9){return _3("dijit.Declaration",_7,{_noScript:true,stopParser:true,widgetClass:"",defaults:null,mixins:[],buildRendering:function(){var _a=this.srcNodeRef.parentNode.removeChild(this.srcNodeRef),_b=_6("> script[type^='dojo/method']",_a).orphan(),_c=_6("> script[type^='dojo/connect']",_a).orphan(),_d=_a.nodeName;var _e=this.defaults||{};_1.forEach(_b,function(s){var _f=s.getAttribute("event")||s.getAttribute("data-dojo-event"),_10=_5._functionFromScript(s);if(_f){_e[_f]=_10;}else{_c.push(s);}});this.mixins=this.mixins.length?_1.map(this.mixins,function(_11){return _4.getObject(_11);}):[_7,_8,_9];_e._skipNodeCache=true;_e.templateString="<"+_d+" class='"+_a.className+"'"+" data-dojo-attach-point='"+(_a.getAttribute("data-dojo-attach-point")||_a.getAttribute("dojoAttachPoint")||"")+"' data-dojo-attach-event='"+(_a.getAttribute("data-dojo-attach-event")||_a.getAttribute("dojoAttachEvent")||"")+"' >"+_a.innerHTML.replace(/\%7B/g,"{").replace(/\%7D/g,"}")+"</"+_d+">";var wc=_3(this.widgetClass,this.mixins,_e);_1.forEach(_c,function(s){var evt=s.getAttribute("event")||s.getAttribute("data-dojo-event")||"postscript",_12=_5._functionFromScript(s);_2.connect(wc.prototype,evt,_12);});}});});
\ No newline at end of file |