CheckBox.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. define("dojox/mobile/CheckBox", [
  2. "dojo/_base/declare",
  3. "dojo/dom-construct",
  4. "dijit/form/_CheckBoxMixin",
  5. "./ToggleButton"
  6. ],
  7. function(declare, domConstruct, CheckBoxMixin, ToggleButton){
  8. /*=====
  9. ToggleButton = dojox.mobile.ToggleButton;
  10. CheckBoxMixin = dijit.form._CheckBoxMixin;
  11. =====*/
  12. return declare("dojox.mobile.CheckBox", [ToggleButton, CheckBoxMixin], {
  13. // summary:
  14. // A non-templated checkbox widget that can be in two states (checked or not).
  15. baseClass: "mblCheckBox",
  16. _setTypeAttr: function(){}, // cannot be changed: IE complains w/o this
  17. buildRendering: function(){
  18. if(!this.srcNodeRef){
  19. // The following doesn't work on IE < 8 if the default state is checked.
  20. // You have to use "<input checked>" instead but it's not worth the bytes here.
  21. this.srcNodeRef = domConstruct.create("input", {type: this.type});
  22. }
  23. this.inherited(arguments);
  24. this.focusNode = this.domNode;
  25. },
  26. _getValueAttr: function(){
  27. return (this.checked ? this.value : false);
  28. }
  29. });
  30. });