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 | 206 +-------------------------------------------- 1 file changed, 2 insertions(+), 204 deletions(-) (limited to 'lib/dijit/form/CheckBox.js') diff --git a/lib/dijit/form/CheckBox.js b/lib/dijit/form/CheckBox.js index 939f6e8bb..1d0bcceaf 100644 --- a/lib/dijit/form/CheckBox.js +++ b/lib/dijit/form/CheckBox.js @@ -1,204 +1,2 @@ -/* - Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved. - Available via Academic Free License >= 2.1 OR the modified BSD license. - see: http://dojotoolkit.org/license for details -*/ - - -if(!dojo._hasResource["dijit.form.CheckBox"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. -dojo._hasResource["dijit.form.CheckBox"] = true; -dojo.provide("dijit.form.CheckBox"); -dojo.require("dijit.form.ToggleButton"); - - -dojo.declare( - "dijit.form.CheckBox", - dijit.form.ToggleButton, - { - // 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: dojo.cache("dijit.form", "templates/CheckBox.html", "
\n"), - - baseClass: "dijitCheckBox", - - // type: [private] String - // type attribute on 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). - // - // However, get('value') will return either the string or false depending on - // whether or not the checkbox is checked. - // - // set('value', string) will check the checkbox and change the value to the - // specified string - // - // set('value', boolean) will change the checked state. - 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, - - // the attributeMap should inherit from dijit.form._FormWidget.prototype.attributeMap - // instead of ToggleButton as the icon mapping has no meaning for a CheckBox - attributeMap: dojo.delegate(dijit.form._FormWidget.prototype.attributeMap, { - readOnly: "focusNode" - }), - - _setReadOnlyAttr: function(/*Boolean*/ value){ - this._set("readOnly", value); - dojo.attr(this.focusNode, 'readOnly', value); - dijit.setWaiState(this.focusNode, "readonly", value); - }, - - _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: ) - if(typeof newValue == "string"){ - this._set("value", newValue); - dojo.attr(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 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"; - } - - // Need to set initial checked state as part of template, so that form submit works. - // dojo.attr(node, "checked", bool) doesn't work on IEuntil node has been attached - // to , see #8666 - this.checkedAttrSetting = this.checked ? "checked" : ""; - - this.inherited(arguments); - }, - - _fillContent: function(/*DomNode*/ source){ - // Override Button::_fillContent() since it doesn't make sense for CheckBox, - // since CheckBox doesn't even have a container - }, - - reset: function(){ - // Override ToggleButton.reset() - - this._hasBeenBlurred = false; - - this.set('checked', this.params.checked || false); - - // Handle unlikely event that the value attribute has changed - this._set("value", this.params.value || "on"); - dojo.attr(this.focusNode, 'value', this.value); - }, - - _onFocus: function(){ - if(this.id){ - dojo.query("label[for='"+this.id+"']").addClass("dijitFocusedLabel"); - } - this.inherited(arguments); - }, - - _onBlur: function(){ - if(this.id){ - dojo.query("label[for='"+this.id+"']").removeClass("dijitFocusedLabel"); - } - this.inherited(arguments); - }, - - _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){ - dojo.stopEvent(e); - return false; - } - return this.inherited(arguments); - } - } -); - -dojo.declare( - "dijit.form.RadioButton", - dijit.form.CheckBox, - { - // summary: - // Same as an HTML radio, but with fancy styling. - - type: "radio", - baseClass: "dijitRadio", - - _setCheckedAttr: function(/*Boolean*/ value){ - // If I am being checked then have to deselect currently checked radio button - this.inherited(arguments); - if(!this._created){ return; } - if(value){ - var _this = this; - // search for radio buttons with the same name that need to be unchecked - dojo.query("INPUT[type=radio]", this.focusNode.form || dojo.doc).forEach( // can't use name= since dojo.query doesn't support [] in the name - function(inputNode){ - if(inputNode.name == _this.name && inputNode != _this.focusNode && inputNode.form == _this.focusNode.form){ - var widget = dijit.getEnclosingWidget(inputNode); - if(widget && widget.checked){ - widget.set('checked', false); - } - } - } - ); - } - }, - - _clicked: function(/*Event*/ e){ - if(!this.checked){ - this.set('checked', true); - } - } - } -); - -} +//>>built +require({cache:{"url:dijit/form/templates/CheckBox.html":"
\n"}});define("dijit/form/CheckBox",["require","dojo/_base/declare","dojo/dom-attr","dojo/_base/kernel","dojo/query","dojo/ready","./ToggleButton","./_CheckBoxMixin","dojo/text!./templates/CheckBox.html","dojo/NodeList-dom"],function(_1,_2,_3,_4,_5,_6,_7,_8,_9){if(!_4.isAsync){_6(0,function(){var _a=["dijit/form/RadioButton"];_1(_a);});}return _2("dijit.form.CheckBox",[_7,_8],{templateString:_9,baseClass:"dijitCheckBox",_setValueAttr:function(_b,_c){if(typeof _b=="string"){this._set("value",_b);_3.set(this.focusNode,"value",_b);_b=true;}if(this._created){this.set("checked",_b,_c);}},_getValueAttr:function(){return (this.checked?this.value:false);},_setIconClassAttr:null,postMixInProperties:function(){this.inherited(arguments);this.checkedAttrSetting=this.checked?"checked":"";},_fillContent:function(){},_onFocus:function(){if(this.id){_5("label[for='"+this.id+"']").addClass("dijitFocusedLabel");}this.inherited(arguments);},_onBlur:function(){if(this.id){_5("label[for='"+this.id+"']").removeClass("dijitFocusedLabel");}this.inherited(arguments);}});}); \ No newline at end of file -- cgit v1.2.3