Skip to content

Commit

Permalink
_FormWidget, _FormWidgetMixin: remove deprecated API's, refs #4:
Browse files Browse the repository at this point in the history
- remove deprecated methods (setDisabled, setValue, getValue)
- remove nameAttrSetting variable; it was only needed for IE6/IE7
- remove dijit-legacy-requires
- use _WidgetBase not _Widget
- stop supporting attributeMap
  • Loading branch information
wkeese committed Apr 29, 2013
1 parent 88acb75 commit fad3ddc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 48 deletions.
53 changes: 6 additions & 47 deletions form/_FormWidget.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,16 @@
define([
"dojo/_base/declare", // declare
"dojo/sniff", // has("dijit-legacy-requires"), has("msapp")
"dojo/_base/kernel", // kernel.deprecated
"dojo/ready",
"../_Widget",
"dojo/sniff", // has("msapp")
"../_WidgetBase",
"../_CssStateMixin",
"../_TemplatedMixin",
"./_FormWidgetMixin"
], function(declare, has, kernel, ready, _Widget, _CssStateMixin, _TemplatedMixin, _FormWidgetMixin){
], function(declare, has, _WidgetBase, _CssStateMixin, _TemplatedMixin, _FormWidgetMixin){

// module:
// dijit/form/_FormWidget

// Back compat w/1.6, remove for 2.0
if(has("dijit-legacy-requires")){
ready(0, function(){
var requires = ["dijit/form/_FormValueWidget"];
require(requires); // use indirection so modules not rolled into a build
});
}

return declare("dijit.form._FormWidget", [_Widget, _TemplatedMixin, _CssStateMixin, _FormWidgetMixin], {
return declare("dijit.form._FormWidget", [_WidgetBase, _TemplatedMixin, _CssStateMixin, _FormWidgetMixin], {
// summary:
// Base class for widgets corresponding to native HTML elements such as `<checkbox>` or `<button>`,
// which can be children of a `<form>` node or a `dijit/form/Form` widget.
Expand All @@ -32,40 +22,9 @@ define([
//
// They also share some common methods.

setDisabled: function(/*Boolean*/ disabled){
// summary:
// Deprecated. Use set('disabled', ...) instead.
kernel.deprecated("setDisabled(" + disabled + ") is deprecated. Use set('disabled'," + disabled + ") instead.", "", "2.0");
this.set('disabled', disabled);
},

setValue: function(/*String*/ value){
// summary:
// Deprecated. Use set('value', ...) instead.
kernel.deprecated("dijit.form._FormWidget:setValue(" + value + ") is deprecated. Use set('value'," + value + ") instead.", "", "2.0");
this.set('value', value);
},

getValue: function(){
// summary:
// Deprecated. Use get('value') instead.
kernel.deprecated(this.declaredClass + "::getValue() is deprecated. Use get('value') instead.", "", "2.0");
return this.get('value');
},

postMixInProperties: function(){
// Setup name=foo string to be referenced from the template (but only if a name has been specified).
// Unfortunately we can't use _setNameAttr to set the name in IE due to IE limitations, see #8484, #8660.
// But when IE6 and IE7 are desupported, then we probably don't need this anymore, so should remove it in 2.0.
// Also, don't do this for Windows 8 Store Apps because it causes a security exception (see #16452).
// Regarding escaping, see heading "Attribute values" in
// http://www.w3.org/TR/REC-html40/appendix/notes.html#h-B.3.2
this.nameAttrSetting = (this.name && !has("msapp")) ? ('name="' + this.name.replace(/"/g, "&quot;") + '"') : '';
this.inherited(arguments);
},

// Override automatic assigning type --> focusNode, it causes exception on IE.
// Instead, type must be specified as ${type} in the template, as part of the original DOM
// Instead, type must be specified as ${type} in the template, as part of the original DOM.
// TODO: check if this is still needed or if it was only an issue for IE6/7
_setTypeAttr: null
});
});
2 changes: 1 addition & 1 deletion form/_FormWidgetMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ define([
this._set("active", false);

// clear tab stop(s) on this widget's focusable node(s) (ComboBox has two focusable nodes)
var attachPointNames = "tabIndex" in this.attributeMap ? this.attributeMap.tabIndex :
var attachPointNames =
("_setTabIndexAttr" in this) ? this._setTabIndexAttr : "focusNode";
array.forEach(lang.isArray(attachPointNames) ? attachPointNames : [attachPointNames], function(attachPointName){
var node = this[attachPointName];
Expand Down

0 comments on commit fad3ddc

Please sign in to comment.