Debian Codegraph @

dijit/_Templated.js

raw symbols SCIP
1 define([
2 "./_WidgetBase",
3 "./_TemplatedMixin",
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){
10
11 // module:
12 // dijit/_Templated
13
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, /*===== {} || =====*/ {
19 waiRole: "",
20 waiState:""
21 });
22
23 return declare("dijit._Templated", [_TemplatedMixin, _WidgetsInTemplateMixin], {
24 // summary:
25 // Deprecated mixin for widgets that are instantiated from a template.
26 // Widgets should use _TemplatedMixin plus if necessary _WidgetsInTemplateMixin instead.
27
28 constructor: function(){
29 kernel.deprecated(this.declaredClass + ": dijit._Templated deprecated, use dijit._TemplatedMixin and if necessary dijit._WidgetsInTemplateMixin", "", "2.0");
30 },
31
32 _processNode: function(baseNode, getAttrFunc){
33 var ret = this.inherited(arguments);
34
35 // Do deprecated waiRole and waiState
36 var role = getAttrFunc(baseNode, "waiRole");
37 if(role){
38 baseNode.setAttribute("role", role);
39 }
40 var values = getAttrFunc(baseNode, "waiState");
41 if(values){
42 array.forEach(values.split(/\s*,\s*/), function(stateValue){
43 if(stateValue.indexOf('-') != -1){
44 var pair = stateValue.split('-');
45 baseNode.setAttribute("aria-"+pair[0], pair[1]);
46 }
47 });
48 }
49
50 return ret;
51 }
52 });
53 });