]> git.wh0rd.org Git - tt-rss.git/blob - lib/dijit/form/CheckBox.js.uncompressed.js
modify dojo rebuild script to remove uncompressed files
[tt-rss.git] / lib / dijit / form / CheckBox.js.uncompressed.js
1 require({cache:{
2 'url:dijit/form/templates/CheckBox.html':"<div class=\"dijit dijitReset dijitInline\" role=\"presentation\"\n\t><input\n\t \t${!nameAttrSetting} type=\"${type}\" role=\"${type}\" aria-checked=\"false\" ${checkedAttrSetting}\n\t\tclass=\"dijitReset dijitCheckBoxInput\"\n\t\tdata-dojo-attach-point=\"focusNode\"\n\t \tdata-dojo-attach-event=\"onclick:_onClick\"\n/></div>\n"}});
3 define("dijit/form/CheckBox", [
4         "require",
5         "dojo/_base/declare", // declare
6         "dojo/dom-attr", // domAttr.set
7         "dojo/has",             // has("dijit-legacy-requires")
8         "dojo/query", // query
9         "dojo/ready",
10         "./ToggleButton",
11         "./_CheckBoxMixin",
12         "dojo/text!./templates/CheckBox.html",
13         "dojo/NodeList-dom" // NodeList.addClass/removeClass
14 ], function(require, declare, domAttr, has, query, ready, ToggleButton, _CheckBoxMixin, template){
15
16         // module:
17         //              dijit/form/CheckBox
18
19         // Back compat w/1.6, remove for 2.0
20         if(has("dijit-legacy-requires")){
21                 ready(0, function(){
22                         var requires = ["dijit/form/RadioButton"];
23                         require(requires);      // use indirection so modules not rolled into a build
24                 });
25         }
26
27         return declare("dijit.form.CheckBox", [ToggleButton, _CheckBoxMixin], {
28                 // summary:
29                 //              Same as an HTML checkbox, but with fancy styling.
30                 //
31                 // description:
32                 //              User interacts with real html inputs.
33                 //              On onclick (which occurs by mouse click, space-bar, or
34                 //              using the arrow keys to switch the selected radio button),
35                 //              we update the state of the checkbox/radio.
36                 //
37                 //              There are two modes:
38                 //
39                 //              1. High contrast mode
40                 //              2. Normal mode
41                 //
42                 //              In case 1, the regular html inputs are shown and used by the user.
43                 //              In case 2, the regular html inputs are invisible but still used by
44                 //              the user. They are turned quasi-invisible and overlay the background-image.
45
46                 templateString: template,
47
48                 baseClass: "dijitCheckBox",
49
50                 _setValueAttr: function(/*String|Boolean*/ newValue, /*Boolean*/ priorityChange){
51                         // summary:
52                         //              Handler for value= attribute to constructor, and also calls to
53                         //              set('value', val).
54                         // description:
55                         //              During initialization, just saves as attribute to the `<input type=checkbox>`.
56                         //
57                         //              After initialization,
58                         //              when passed a boolean, controls whether or not the CheckBox is checked.
59                         //              If passed a string, changes the value attribute of the CheckBox (the one
60                         //              specified as "value" when the CheckBox was constructed
61                         //              (ex: `<input data-dojo-type="dijit/CheckBox" value="chicken">`).
62                         //
63                         //              `widget.set('value', string)` will check the checkbox and change the value to the
64                         //              specified string.
65                         //
66                         //              `widget.set('value', boolean)` will change the checked state.
67
68                         if(typeof newValue == "string"){
69                                 this.inherited(arguments);
70                                 newValue = true;
71                         }
72                         if(this._created){
73                                 this.set('checked', newValue, priorityChange);
74                         }
75                 },
76                 _getValueAttr: function(){
77                         // summary:
78                         //              Hook so get('value') works.
79                         // description:
80                         //              If the CheckBox is checked, returns the value attribute.
81                         //              Otherwise returns false.
82                         return (this.checked ? this.value : false);
83                 },
84
85                 // Override behavior from Button, since we don't have an iconNode
86                 _setIconClassAttr: null,
87
88                 postMixInProperties: function(){
89                         this.inherited(arguments);
90
91                         // Need to set initial checked state as part of template, so that form submit works.
92                         // domAttr.set(node, "checked", bool) doesn't work on IE until node has been attached
93                         // to <body>, see #8666
94                         this.checkedAttrSetting = this.checked ? "checked" : "";
95                 },
96
97                  _fillContent: function(){
98                         // Override Button::_fillContent() since it doesn't make sense for CheckBox,
99                         // since CheckBox doesn't even have a container
100                 },
101
102                 _onFocus: function(){
103                         if(this.id){
104                                 query("label[for='"+this.id+"']").addClass("dijitFocusedLabel");
105                         }
106                         this.inherited(arguments);
107                 },
108
109                 _onBlur: function(){
110                         if(this.id){
111                                 query("label[for='"+this.id+"']").removeClass("dijitFocusedLabel");
112                         }
113                         this.inherited(arguments);
114                 }
115         });
116 });