]>
git.wh0rd.org - tt-rss.git/blob - lib/dijit/_Templated.js.uncompressed.js
1 define ( "dijit/_Templated" , [
4 "./_WidgetsInTemplateMixin" ,
5 "dojo/_base/array" , // array.forEach
6 "dojo/_base/declare" , // declare
7 "dojo/_base/lang" , // lang.extend lang.isArray
8 "dojo/_base/kernel" // kernel.deprecated
9 ], function ( _WidgetBase
, _TemplatedMixin
, _WidgetsInTemplateMixin
, array
, declare
, lang
, kernel
){
12 var _WidgetBase = dijit._WidgetBase;
13 var _TemplatedMixin = dijit._TemplatedMixin;
14 var _WidgetsInTemplateMixin = dijit._WidgetsInTemplateMixin;
20 // Deprecated mixin for widgets that are instantiated from a template.
22 // These arguments can be specified for widgets which are used in templates.
23 // Since any widget can be specified as sub widgets in template, mix it
24 // into the base widget class. (This is a hack, but it's effective.)
25 lang
. extend ( _WidgetBase
, {
30 return declare ( "dijit._Templated" , [ _TemplatedMixin
, _WidgetsInTemplateMixin
], {
32 // Deprecated mixin for widgets that are instantiated from a template.
33 // Widgets should use _TemplatedMixin plus if necessary _WidgetsInTemplateMixin instead.
35 // widgetsInTemplate: [protected] Boolean
36 // Should we parse the template to find widgets that might be
37 // declared in markup inside it? False by default.
38 widgetsInTemplate
: false ,
40 constructor : function (){
41 kernel
. deprecated ( this . declaredClass
+ ": dijit._Templated deprecated, use dijit._TemplatedMixin and if necessary dijit._WidgetsInTemplateMixin" , "" , "2.0" );
44 _attachTemplateNodes : function ( rootNode
, getAttrFunc
){
46 this . inherited ( arguments
);
48 // Do deprecated waiRole and waiState
49 var nodes
= lang
. isArray ( rootNode
) ? rootNode
: ( rootNode
. all
|| rootNode
. getElementsByTagName ( "*" ));
50 var x
= lang
. isArray ( rootNode
) ? 0 : - 1 ;
51 for (; x
< nodes
. length
; x
++){
52 var baseNode
= ( x
== - 1 ) ? rootNode
: nodes
[ x
];
55 var role
= getAttrFunc ( baseNode
, "waiRole" );
57 baseNode
. setAttribute ( "role" , role
);
59 var values
= getAttrFunc ( baseNode
, "waiState" );
61 array
. forEach ( values
. split ( /\s*,\s*/ ), function ( stateValue
){
62 if ( stateValue
. indexOf ( '-' ) != - 1 ){
63 var pair
= stateValue
. split ( '-' );
64 baseNode
. setAttribute ( "aria-" + pair
[ 0 ], pair
[ 1 ]);