[483] | 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 | // 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, |
---|
| 32 | |
---|
| 33 | constructor: function(){ |
---|
| 34 | kernel.deprecated(this.declaredClass + ": dijit._Templated deprecated, use dijit._TemplatedMixin and if necessary dijit._WidgetsInTemplateMixin", "", "2.0"); |
---|
| 35 | }, |
---|
| 36 | |
---|
| 37 | _processNode: function(baseNode, getAttrFunc){ |
---|
| 38 | var ret = this.inherited(arguments); |
---|
| 39 | |
---|
| 40 | // Do deprecated waiRole and waiState |
---|
| 41 | var role = getAttrFunc(baseNode, "waiRole"); |
---|
| 42 | if(role){ |
---|
| 43 | baseNode.setAttribute("role", role); |
---|
| 44 | } |
---|
| 45 | var values = getAttrFunc(baseNode, "waiState"); |
---|
| 46 | if(values){ |
---|
| 47 | array.forEach(values.split(/\s*,\s*/), function(stateValue){ |
---|
| 48 | if(stateValue.indexOf('-') != -1){ |
---|
| 49 | var pair = stateValue.split('-'); |
---|
| 50 | baseNode.setAttribute("aria-"+pair[0], pair[1]); |
---|
| 51 | } |
---|
| 52 | }); |
---|
| 53 | } |
---|
| 54 | |
---|
| 55 | return ret; |
---|
| 56 | } |
---|
| 57 | }); |
---|
| 58 | }); |
---|