button-core-min.js revision d0f9ee99aee2d631a24062cd95d30c1d6955fc0f
YUI.add("button-core",function(c){var b=c.ClassNameManager.getClassName;function a(d){this.initializer(d);}a.prototype={TEMPLATE:"<button/>",constructor:a,initializer:function(d){this._initNode(d);this._initAttributes(d);this._renderUI(d);},_initNode:function(d){if(d.host){this._host=c.one(d.host);}else{this._host=c.Node.create(this.TEMPLATE);}},_initAttributes:function(d){var f=this._host,e=this._getLabelNode(f);d.label=d.label||this._getLabel(e);c.AttributeCore.call(this,a.ATTRS,d);},_renderUI:function(d){var f=this.getNode(),e=f.get("tagName").toLowerCase();f.addClass(a.CLASS_NAMES.BUTTON);if(e!=="button"&&e!=="input"){f.set("role","button");}},enable:function(){this.set("disabled",false);},disable:function(){this.set("disabled",true);},getNode:function(){return this._host;},_getLabel:function(){var e=this.getNode(),d=e.get("tagName").toLowerCase();if(d==="input"){return e.get("value");}return(e.one("."+a.CLASS_NAMES.LABEL)||e).get("text");},_setLabel:function(g){var e=this.getNode(),f=this._getLabelNode(e),d=(f.get("tagName").toLowerCase()==="input")?"value":"innerHTML";f.set(d,g);return g;},_setDisabled:function(e){var d=this.getNode();d.getDOMNode().disabled=e;d.toggleClass(a.CLASS_NAMES.DISABLED,e);return e;},_getLabelNode:function(d){return d.one("."+a.CLASS_NAMES.LABEL)||d;}};a.ATTRS={label:{setter:"_setLabel",getter:"_getLabel",lazyAdd:false},disabled:{value:false,setter:"_setDisabled",lazyAdd:false}};a.NAME="button";a.CLASS_NAMES={BUTTON:b("button"),DISABLED:b("button","disabled"),SELECTED:b("button","selected"),LABEL:b("button","label")};c.mix(a.prototype,c.AttributeCore.prototype);c.ButtonCore=a;},"@VERSION@",{requires:["attribute-core","classnamemanager","node-base"]});