dojox
Version:
Dojo eXtensions, a rollup of many useful sub-projects and varying states of maturity – from very stable and robust, to alpha and experimental. See individual projects contain README files for details.
22 lines (18 loc) • 711 B
JavaScript
define([
"dojo/_base/declare",
"dojo/dom-class",
"dijit/form/_ToggleButtonMixin",
"./Button"
], function(declare, domClass, ToggleButtonMixin, Button){
return declare("dojox.mobile.ToggleButton", [Button, ToggleButtonMixin], {
// summary:
// A non-templated button widget that can be in two states (checked or not).
// Can be base class for things like tabs or checkbox or radio buttons
baseClass: "mblToggleButton",
_setCheckedAttr: function(){
this.inherited(arguments);
var newStateClasses = (this.baseClass+' '+this["class"]).replace(/(\S+)\s*/g, "$1Checked ").split(" ");
domClass[this.checked ? "add" : "remove"](this.focusNode || this.domNode, newStateClasses);
}
});
});