button-core-min.js revision 65aeef931a8f8abce78e6f0fafec90308ceaec34
YUI.add("button-core",function(c){function b(d){if(d){return c.ClassNameManager.getClassName(a.NAME,d);}else{return c.ClassNameManager.getClassName(a.NAME);}}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.srcNode){this._host=c.one(d.srcNode);}else{this._host=c.Node.create(this.TEMPLATE);}},_initAttributes:function(d){d.label=d.label||d.host.getContent();c.AttributeCore.call(this,a.ATTRS,d);},_renderUI:function(d){var e=this.getNode();e.addClass(a.CLASS_NAMES.BUTTON);e.set("role","button");},enable:function(){this.set("disabled",false);},disable:function(){this.set("disabled",true);},getNode:function(){return this._host;},_uiSetLabel:function(f){var e=this.getNode(),d=(e.get("tagName").toLowerCase()==="input")?"value":"text";e.set(d,f);return f;},_uiSetDisabled:function(e){var d=this.getNode();d.getDOMNode().disabled=e;d.toggleClass(a.CLASS_NAMES.DISABLED,e);return e;},_uiGetLabel:function(){var e=this.getNode(),d=(e.get("tagName").toLowerCase()==="input")?"value":"text",f;f=e.get(d);return f;}};a.ATTRS={label:{setter:"_uiSetLabel",getter:"_uiGetLabel",lazyAdd:false},disabled:{value:false,setter:"_uiSetDisabled",lazyAdd:false}};a.NAME="button";a.CLASS_NAMES={BUTTON:b(),DISABLED:b("disabled"),SELECTED:b("selected")};c.mix(a.prototype,c.AttributeCore.prototype);c.ButtonCore=a;},"@VERSION@",{requires:["node"]});