]>
git.wh0rd.org - tt-rss.git/blob - lib/dijit/form/_CheckBoxMixin.js.uncompressed.js
1 define("dijit/form/_CheckBoxMixin", [
2 "dojo/_base/declare", // declare
3 "dojo/dom-attr", // domAttr.set
4 "dojo/_base/event" // event.stop
5 ], function(declare
, domAttr
, event
){
8 // dijit/form/_CheckBoxMixin
10 // Mixin to provide widget functionality corresponding to an HTML checkbox
12 return declare("dijit.form._CheckBoxMixin", null, {
14 // Mixin to provide widget functionality corresponding to an HTML checkbox
17 // User interacts with real html inputs.
18 // On onclick (which occurs by mouse click, space-bar, or
19 // using the arrow keys to switch the selected radio button),
20 // we update the state of the checkbox/radio.
23 // type: [private] String
24 // type attribute on <input> node.
25 // Overrides `dijit.form.Button.type`. Users should not change this value.
29 // As an initialization parameter, equivalent to value field on normal checkbox
30 // (if checked, the value is passed as the value when form is submitted).
34 // Should this widget respond to user input?
35 // In markup, this is specified as "readOnly".
36 // Similar to disabled except readOnly form values are submitted.
39 // aria-pressed for toggle buttons, and aria-checked for checkboxes
40 _aria_attr
: "aria-checked",
42 _setReadOnlyAttr: function(/*Boolean*/ value
){
43 this._set("readOnly", value
);
44 domAttr
.set(this.focusNode
, 'readOnly', value
);
45 this.focusNode
.setAttribute("aria-readonly", value
);
48 // Override dijit.form.Button._setLabelAttr() since we don't even have a containerNode.
49 // Normally users won't try to set label, except when CheckBox or RadioButton is the child of a dojox.layout.TabContainer
50 _setLabelAttr
: undefined,
52 postMixInProperties: function(){
56 this.inherited(arguments
);
60 this.inherited(arguments
);
61 // Handle unlikely event that the <input type=checkbox> value attribute has changed
62 this._set("value", this.params
.value
|| "on");
63 domAttr
.set(this.focusNode
, 'value', this.value
);
66 _onClick: function(/*Event*/ e
){
68 // Internal function to handle click actions - need to check
69 // readOnly, since button no longer does that check.
74 return this.inherited(arguments
);