From 1354d17270961fff662d40f90521223f8fd0d73b Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 14 Aug 2012 18:59:10 +0400 Subject: update dojo to 1.7.3 --- lib/dijit/form/CheckBox.js.uncompressed.js | 120 +++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 lib/dijit/form/CheckBox.js.uncompressed.js (limited to 'lib/dijit/form/CheckBox.js.uncompressed.js') diff --git a/lib/dijit/form/CheckBox.js.uncompressed.js b/lib/dijit/form/CheckBox.js.uncompressed.js new file mode 100644 index 000000000..4663e1e69 --- /dev/null +++ b/lib/dijit/form/CheckBox.js.uncompressed.js @@ -0,0 +1,120 @@ +require({cache:{ +'url:dijit/form/templates/CheckBox.html':"
\n"}}); +define("dijit/form/CheckBox", [ + "require", + "dojo/_base/declare", // declare + "dojo/dom-attr", // domAttr.set + "dojo/_base/kernel", + "dojo/query", // query + "dojo/ready", + "./ToggleButton", + "./_CheckBoxMixin", + "dojo/text!./templates/CheckBox.html", + "dojo/NodeList-dom" // NodeList.addClass/removeClass +], function(require, declare, domAttr, kernel, query, ready, ToggleButton, _CheckBoxMixin, template){ + +/*===== + var ToggleButton = dijit.form.ToggleButton; + var _CheckBoxMixin = dijit.form._CheckBoxMixin; +=====*/ + + // module: + // dijit/form/CheckBox + // summary: + // Checkbox widget + + // Back compat w/1.6, remove for 2.0 + if(!kernel.isAsync){ + ready(0, function(){ + var requires = ["dijit/form/RadioButton"]; + require(requires); // use indirection so modules not rolled into a build + }); + } + + return declare("dijit.form.CheckBox", [ToggleButton, _CheckBoxMixin], { + // summary: + // Same as an HTML checkbox, but with fancy styling. + // + // 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. + // + // There are two modes: + // 1. High contrast mode + // 2. Normal mode + // + // In case 1, the regular html inputs are shown and used by the user. + // In case 2, the regular html inputs are invisible but still used by + // the user. They are turned quasi-invisible and overlay the background-image. + + templateString: template, + + baseClass: "dijitCheckBox", + + _setValueAttr: function(/*String|Boolean*/ newValue, /*Boolean*/ priorityChange){ + // summary: + // Handler for value= attribute to constructor, and also calls to + // set('value', val). + // description: + // During initialization, just saves as attribute to the . + // + // After initialization, + // when passed a boolean, controls whether or not the CheckBox is checked. + // If passed a string, changes the value attribute of the CheckBox (the one + // specified as "value" when the CheckBox was constructed (ex: ) + // widget.set('value', string) will check the checkbox and change the value to the + // specified string + // widget.set('value', boolean) will change the checked state. + if(typeof newValue == "string"){ + this._set("value", newValue); + domAttr.set(this.focusNode, 'value', newValue); + newValue = true; + } + if(this._created){ + this.set('checked', newValue, priorityChange); + } + }, + _getValueAttr: function(){ + // summary: + // Hook so get('value') works. + // description: + // If the CheckBox is checked, returns the value attribute. + // Otherwise returns false. + return (this.checked ? this.value : false); + }, + + // Override behavior from Button, since we don't have an iconNode + _setIconClassAttr: null, + + postMixInProperties: function(){ + this.inherited(arguments); + + // Need to set initial checked state as part of template, so that form submit works. + // domAttr.set(node, "checked", bool) doesn't work on IE until node has been attached + // to , see #8666 + this.checkedAttrSetting = this.checked ? "checked" : ""; + }, + + _fillContent: function(){ + // Override Button::_fillContent() since it doesn't make sense for CheckBox, + // since CheckBox doesn't even have a container + }, + + _onFocus: function(){ + if(this.id){ + query("label[for='"+this.id+"']").addClass("dijitFocusedLabel"); + } + this.inherited(arguments); + }, + + _onBlur: function(){ + if(this.id){ + query("label[for='"+this.id+"']").removeClass("dijitFocusedLabel"); + } + this.inherited(arguments); + } + }); +}); -- cgit v1.2.3