]>
git.wh0rd.org - tt-rss.git/blob - lib/dijit/_WidgetsInTemplateMixin.js.uncompressed.js
9108931d5c5359e0fa13affb341121204b6235f1
1 define("dijit/_WidgetsInTemplateMixin", [
2 "dojo/_base/array", // array.forEach
3 "dojo/_base/declare", // declare
4 "dojo/parser" // parser.parse
5 ], function(array
, declare
, parser
){
8 // dijit/_WidgetsInTemplateMixin
10 return declare("dijit._WidgetsInTemplateMixin", null, {
12 // Mixin to supplement _TemplatedMixin when template contains widgets
14 // _earlyTemplatedStartup: Boolean
15 // A fallback to preserve the 1.0 - 1.3 behavior of children in
16 // templates having their startup called before the parent widget
17 // fires postCreate. Defaults to 'false', causing child widgets to
18 // have their .startup() called immediately before a parent widget
19 // .startup(), but always after the parent .postCreate(). Set to
20 // 'true' to re-enable to previous, arguably broken, behavior.
21 _earlyTemplatedStartup
: false,
23 // widgetsInTemplate: [protected] Boolean
24 // Should we parse the template to find widgets that might be
25 // declared in markup inside it? (Remove for 2.0 and assume true)
26 widgetsInTemplate
: true,
28 _beforeFillContent: function(){
29 if(this.widgetsInTemplate
){
30 // Before copying over content, instantiate widgets in template
31 var node
= this.domNode
;
33 var cw
= (this._startupWidgets
= parser
.parse(node
, {
34 noStart
: !this._earlyTemplatedStartup
,
36 inherited
: {dir
: this.dir
, lang
: this.lang
, textDir
: this.textDir
},
37 propsThis
: this, // so data-dojo-props of widgets in the template can reference "this" to refer to me
38 scope
: "dojo" // even in multi-version mode templates use dojoType/data-dojo-type
41 if(!cw
.isFulfilled()){
42 throw new Error(this.declaredClass
+ ": parser returned unfilled promise (probably waiting for module auto-load), " +
43 "unsupported by _WidgetsInTemplateMixin. Must pre-load all supporting widgets before instantiation.");
46 // _WidgetBase::destroy() will destroy any supporting widgets under this.domNode.
47 // If we wanted to, we could call this.own() on anything in this._startupWidgets that was moved outside
48 // of this.domNode (like Dialog, which is moved to <body>).
50 this._attachTemplateNodes(cw
, function(n
,p
){
57 array
.forEach(this._startupWidgets
, function(w
){
58 if(w
&& !w
._started
&& w
.startup
){
62 this.inherited(arguments
);