diff options
author | Andrew Dolgov <[email protected]> | 2012-08-14 18:59:10 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2012-08-14 18:59:18 +0400 |
commit | 1354d17270961fff662d40f90521223f8fd0d73b (patch) | |
tree | e9266be71587e47c800303446e968a6d3565e2cf /lib/dijit/form/_CheckBoxMixin.js.uncompressed.js | |
parent | d04f8c826f5283765f52cf6b98b42a1ed8f2d6bc (diff) |
update dojo to 1.7.3
Diffstat (limited to 'lib/dijit/form/_CheckBoxMixin.js.uncompressed.js')
-rw-r--r-- | lib/dijit/form/_CheckBoxMixin.js.uncompressed.js | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/lib/dijit/form/_CheckBoxMixin.js.uncompressed.js b/lib/dijit/form/_CheckBoxMixin.js.uncompressed.js new file mode 100644 index 000000000..703f8ead7 --- /dev/null +++ b/lib/dijit/form/_CheckBoxMixin.js.uncompressed.js @@ -0,0 +1,77 @@ +define("dijit/form/_CheckBoxMixin", [ + "dojo/_base/declare", // declare + "dojo/dom-attr", // domAttr.set + "dojo/_base/event" // event.stop +], function(declare, domAttr, event){ + + // module: + // dijit/form/_CheckBoxMixin + // summary: + // Mixin to provide widget functionality corresponding to an HTML checkbox + + return declare("dijit.form._CheckBoxMixin", null, { + // summary: + // Mixin to provide widget functionality corresponding to an HTML checkbox + // + // description: + // User interacts with real html inputs. + // On onclick (which occurs by mouse click, space-bar, or + // using the arrow keys to switch the selected radio button), + // we update the state of the checkbox/radio. + // + + // type: [private] String + // type attribute on <input> node. + // Overrides `dijit.form.Button.type`. Users should not change this value. + type: "checkbox", + + // value: String + // As an initialization parameter, equivalent to value field on normal checkbox + // (if checked, the value is passed as the value when form is submitted). + value: "on", + + // readOnly: Boolean + // Should this widget respond to user input? + // In markup, this is specified as "readOnly". + // Similar to disabled except readOnly form values are submitted. + readOnly: false, + + // aria-pressed for toggle buttons, and aria-checked for checkboxes + _aria_attr: "aria-checked", + + _setReadOnlyAttr: function(/*Boolean*/ value){ + this._set("readOnly", value); + domAttr.set(this.focusNode, 'readOnly', value); + this.focusNode.setAttribute("aria-readonly", value); + }, + + // Override dijit.form.Button._setLabelAttr() since we don't even have a containerNode. + // Normally users won't try to set label, except when CheckBox or RadioButton is the child of a dojox.layout.TabContainer + _setLabelAttr: undefined, + + postMixInProperties: function(){ + if(this.value == ""){ + this.value = "on"; + } + this.inherited(arguments); + }, + + reset: function(){ + this.inherited(arguments); + // Handle unlikely event that the <input type=checkbox> value attribute has changed + this._set("value", this.params.value || "on"); + domAttr.set(this.focusNode, 'value', this.value); + }, + + _onClick: function(/*Event*/ e){ + // summary: + // Internal function to handle click actions - need to check + // readOnly, since button no longer does that check. + if(this.readOnly){ + event.stop(e); + return false; + } + return this.inherited(arguments); + } + }); +}); |