]>
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
){
14 // These arguments can be specified for widgets which are used in templates.
15 // Since any widget can be specified as sub widgets in template, mix it
16 // into the base widget class. (This is a hack, but it's effective.)
17 // Remove for 2.0. Also, hide from API doc parser.
18 lang
. extend ( _WidgetBase
, /*===== {} || =====*/ {
23 return declare ( "dijit._Templated" , [ _TemplatedMixin
, _WidgetsInTemplateMixin
], {
25 // Deprecated mixin for widgets that are instantiated from a template.
26 // Widgets should use _TemplatedMixin plus if necessary _WidgetsInTemplateMixin instead.
28 // widgetsInTemplate: [protected] Boolean
29 // Should we parse the template to find widgets that might be
30 // declared in markup inside it? False by default.
31 widgetsInTemplate
: false ,
33 constructor : function (){
34 kernel
. deprecated ( this . declaredClass
+ ": dijit._Templated deprecated, use dijit._TemplatedMixin and if necessary dijit._WidgetsInTemplateMixin" , "" , "2.0" );
37 _attachTemplateNodes : function ( rootNode
, getAttrFunc
){
39 this . inherited ( arguments
);
41 // Do deprecated waiRole and waiState
42 var nodes
= lang
. isArray ( rootNode
) ? rootNode
: ( rootNode
. all
|| rootNode
. getElementsByTagName ( "*" ));
43 var x
= lang
. isArray ( rootNode
) ? 0 : - 1 ;
44 for (; x
< nodes
. length
; x
++){
45 var baseNode
= ( x
== - 1 ) ? rootNode
: nodes
[ x
];
48 var role
= getAttrFunc ( baseNode
, "waiRole" );
50 baseNode
. setAttribute ( "role" , role
);
52 var values
= getAttrFunc ( baseNode
, "waiState" );
54 array
. forEach ( values
. split ( /\s*,\s*/ ), function ( stateValue
){
55 if ( stateValue
. indexOf ( '-' ) != - 1 ){
56 var pair
= stateValue
. split ( '-' );
57 baseNode
. setAttribute ( "aria-" + pair
[ 0 ], pair
[ 1 ]);