From 175a8407c9a21fa26ef0abd3466bccf7adafce09 Mon Sep 17 00:00:00 2001 From: Mark Waite Date: Tue, 18 May 2021 14:15:35 -0600 Subject: [PATCH] better 0eb9318cca: preventDefault only if submitForm has called requestSubmit [JENKINS-65585] avoid double-submit in HtmlUnit when clicking a submit button [JENKINS-65585] pass the submitter to requestSubmit() Cherry pick from 8edaa20628b39010f0f80f36ffb85ab1d04c7574 Cherry pick from 0eb9318ccae630150808f5f0dfd4f49ef8fb9592 Cherry pick from b7d8c122b2619e431dd2b9fb5627991d04dfcf90 --- .../webapp/scripts/yui/button/button-debug.js | 42 +++++++++++++++---- .../webapp/scripts/yui/button/button-min.js | 8 ++-- 2 files changed, 38 insertions(+), 12 deletions(-) diff --git a/war/src/main/webapp/scripts/yui/button/button-debug.js b/war/src/main/webapp/scripts/yui/button/button-debug.js index fb3045cca4bc9..d4d611bc2ff63 100755 --- a/war/src/main/webapp/scripts/yui/button/button-debug.js +++ b/war/src/main/webapp/scripts/yui/button/button-debug.js @@ -1974,8 +1974,10 @@ version: 2.9.0 if (p_oEvent.returnValue !== false) { - this.submitForm(); - + if (this.submitForm() == "requestSubmit") { + // avoid double form submission in HtmlUnit + Event.preventDefault(p_oEvent); + } } break; @@ -2425,11 +2427,18 @@ version: 2.9.0 var sNodeName = this.NODE_NAME, oElement = document.createElement(sNodeName); - - oElement.innerHTML = "<" + sNodeName + " class=\"first-child\">" + - (p_sType == "link" ? "" : - "") + ""; - + + var childHTML; + if (p_sType == "link") { + childHTML = ""; + } else if (p_sType == "submit") { + childHTML = ""; + } else { + childHTML = ""; + } + oElement.innerHTML = "<" + sNodeName + " class=\"first-child\">" + + childHTML + ""; + return oElement; }, @@ -2695,7 +2704,24 @@ version: 2.9.0 m_oSubmitTrigger = this; } - + + if (oForm.requestSubmit) { + /* + If 'requestSubmit' is defined, use that instead of manually firing the event and then calling 'submit'. + See https://caniuse.com/mdn-api_htmlformelement_requestsubmit + */ + if (this.get("type") == "submit") { + /* Trying very hard to find the right button... + See https://issues.jenkins.io/browse/JENKINS-65585 */ + var buttons = this.getElementsByTagName('button'); + if (buttons.length == 1 && buttons[0].type == 'submit') { + oForm.requestSubmit(buttons[0]); + return "requestSubmit"; + } + } + oForm.requestSubmit(); + return "requestSubmit"; + } if (UA.ie && (UA.ie < 9)) { diff --git a/war/src/main/webapp/scripts/yui/button/button-min.js b/war/src/main/webapp/scripts/yui/button/button-min.js index 17416d103bc49..51f9d3ea9bc57 100644 --- a/war/src/main/webapp/scripts/yui/button/button-min.js +++ b/war/src/main/webapp/scripts/yui/button/button-min.js @@ -6,7 +6,7 @@ */ (function(){var g=YAHOO.util.Dom,m=YAHOO.util.Event,i=YAHOO.lang,l=YAHOO.env.ua,b=YAHOO.widget.Overlay,j=YAHOO.widget.Menu,d={},k=null,e=null,c=null;function f(o,n,r,p){var s,q;if(i.isString(o)&&i.isString(n)){if(l.ie&&(l.ie<9)){q='0){v.label=q}}}function a(p){var o=p.attributes,n=o.srcelement,r=n.nodeName.toUpperCase(),q=this;if(r==this.NODE_NAME){p.element=n;p.id=n.id;g.getElementsBy(function(s){switch(s.nodeName.toUpperCase()){case"BUTTON":case"A":case"INPUT":h.call(q,s,o);break}},"*",n)}else{switch(r){case"BUTTON":case"A":case"INPUT":h.call(this,n,o);break}}}YAHOO.widget.Button=function(r,o){if(!b&&YAHOO.widget.Overlay){b=YAHOO.widget.Overlay}if(!j&&YAHOO.widget.Menu){j=YAHOO.widget.Menu}var q=YAHOO.widget.Button.superclass.constructor,p,n;if(arguments.length==1&&!i.isString(r)&&!r.nodeName){if(!r.id){r.id=g.generateId();YAHOO.log('No value specified for the button\'s "id" attribute. Setting button id to "'+r.id+'".',"info",this.toString())}YAHOO.log("No source HTML element. Building the button using the set of configuration attributes.","info",this.toString());q.call(this,(this.createButtonElement(r.type)),r)}else{p={element:null,attributes:(o||{})};if(i.isString(r)){n=g.get(r);if(n){if(!p.attributes.id){p.attributes.id=r}YAHOO.log("Building the button using an existing HTML element as a source element.","info",this.toString());p.attributes.srcelement=n;a.call(this,p);if(!p.element){YAHOO.log("Source element could not be used as is. Creating a new HTML element for the button.","info",this.toString());p.element=this.createButtonElement(p.attributes.type)}q.call(this,p.element,p.attributes)}}else{if(r.nodeName){if(!p.attributes.id){if(r.id){p.attributes.id=r.id}else{p.attributes.id=g.generateId();YAHOO.log('No value specified for the button\'s "id" attribute. Setting button id to "'+p.attributes.id+'".',"info",this.toString())}}YAHOO.log("Building the button using an existing HTML element as a source element.","info",this.toString());p.attributes.srcelement=r;a.call(this,p);if(!p.element){YAHOO.log("Source element could not be used as is. Creating a new HTML element for the button.","info",this.toString());p.element=this.createButtonElement(p.attributes.type)}q.call(this,p.element,p.attributes)}}}};YAHOO.extend(YAHOO.widget.Button,YAHOO.util.Element,{_button:null,_menu:null,_hiddenFields:null,_onclickAttributeValue:null,_activationKeyPressed:false,_activationButtonPressed:false,_hasKeyEventHandlers:false,_hasMouseEventHandlers:false,_nOptionRegionX:0,CLASS_NAME_PREFIX:"yui-",NODE_NAME:"SPAN",CHECK_ACTIVATION_KEYS:[32],ACTIVATION_KEYS:[13,32],OPTION_AREA_WIDTH:20,CSS_CLASS_NAME:"button",_setType:function(n){if(n=="split"){this.on("option",this._onOption)}},_setLabel:function(o){this._button.innerHTML=o;var p,n=l.gecko;if(n&&n<1.9&&g.inDocument(this.get("element"))){p=(this.CLASS_NAME_PREFIX+this.CSS_CLASS_NAME);this.removeClass(p);i.later(0,this,this.addClass,p)}},_setTabIndex:function(n){this._button.tabIndex=n},_setTitle:function(n){if(this.get("type")!="link"){this._button.title=n}},_setDisabled:function(n){if(this.get("type")!="link"){if(n){if(this._menu){this._menu.hide()}if(this.hasFocus()){this.blur()}this._button.setAttribute("disabled","disabled");this.addStateCSSClasses("disabled");this.removeStateCSSClasses("hover");this.removeStateCSSClasses("active");this.removeStateCSSClasses("focus")}else{this._button.removeAttribute("disabled");this.removeStateCSSClasses("disabled")}}},_setHref:function(n){if(this.get("type")=="link"){this._button.href=n}},_setTarget:function(n){if(this.get("type")=="link"){this._button.setAttribute("target",n)}},_setChecked:function(n){var o=this.get("type");if(o=="checkbox"||o=="radio"){if(n){this.addStateCSSClasses("checked")}else{this.removeStateCSSClasses("checked")}}},_setMenu:function(u){var p=this.get("lazyloadmenu"),r=this.get("element"),n,w=false,x,o,q;function v(){x.render(r.parentNode);this.removeListener("appendTo",v)}function t(){x.cfg.queueProperty("container",r.parentNode);this.removeListener("appendTo",t)}function s(){var y;if(x){g.addClass(x.element,this.get("menuclassname"));g.addClass(x.element,this.CLASS_NAME_PREFIX+this.get("type")+"-button-menu");x.showEvent.subscribe(this._onMenuShow,null,this);x.hideEvent.subscribe(this._onMenuHide,null,this);x.renderEvent.subscribe(this._onMenuRender,null,this);if(j&&x instanceof j){if(p){y=this.get("container");if(y){x.cfg.queueProperty("container",y)}else{this.on("appendTo",t)}}x.cfg.queueProperty("clicktohide",false);x.keyDownEvent.subscribe(this._onMenuKeyDown,this,true);x.subscribe("click",this._onMenuClick,this,true);this.on("selectedMenuItemChange",this._onSelectedMenuItemChange);q=x.srcElement;if(q&&q.nodeName.toUpperCase()=="SELECT"){q.style.display="none";q.parentNode.removeChild(q)}}else{if(b&&x instanceof b){if(!k){k=new YAHOO.widget.OverlayManager()}k.register(x)}}this._menu=x;if(!w&&!p){if(g.inDocument(r)){x.render(r.parentNode) }else{this.on("appendTo",v)}}}}if(b){if(j){n=j.prototype.CSS_CLASS_NAME}if(u&&j&&(u instanceof j)){x=u;w=true;s.call(this)}else{if(b&&u&&(u instanceof b)){x=u;w=true;x.cfg.queueProperty("visible",false);s.call(this)}else{if(j&&i.isArray(u)){x=new j(g.generateId(),{lazyload:p,itemdata:u});this._menu=x;this.on("appendTo",s)}else{if(i.isString(u)){o=g.get(u);if(o){if(j&&g.hasClass(o,n)||o.nodeName.toUpperCase()=="SELECT"){x=new j(u,{lazyload:p});s.call(this)}else{if(b){x=new b(u,{visible:false});s.call(this)}}}}else{if(u&&u.nodeName){if(j&&g.hasClass(u,n)||u.nodeName.toUpperCase()=="SELECT"){x=new j(u,{lazyload:p});s.call(this)}else{if(b){if(!u.id){g.generateId(u)}x=new b(u,{visible:false});s.call(this)}}}}}}}}},_setOnClick:function(n){if(this._onclickAttributeValue&&(this._onclickAttributeValue!=n)){this.removeListener("click",this._onclickAttributeValue.fn);this._onclickAttributeValue=null}if(!this._onclickAttributeValue&&i.isObject(n)&&i.isFunction(n.fn)){this.on("click",n.fn,n.obj,n.scope);this._onclickAttributeValue=n}},_isActivationKey:function(n){var s=this.get("type"),o=(s=="checkbox"||s=="radio")?this.CHECK_ACTIVATION_KEYS:this.ACTIVATION_KEYS,q=o.length,r=false,p;if(q>0){p=q-1;do{if(n==o[p]){r=true;break}}while(p--)}return r},_isSplitButtonOptionKey:function(p){var o=(m.getCharCode(p)==40);var n=function(q){m.preventDefault(q);this.removeListener("keypress",n)};if(o){if(l.opera){this.on("keypress",n)}m.preventDefault(p)}return o},_addListenersToForm:function(){var t=this.getForm(),s=YAHOO.widget.Button.onFormKeyPress,r,n,q,p,o;if(t){m.on(t,"reset",this._onFormReset,null,this);m.on(t,"submit",this._onFormSubmit,null,this);n=this.get("srcelement");if(this.get("type")=="submit"||(n&&n.type=="submit")){q=m.getListeners(t,"keypress");r=false;if(q){p=q.length;if(p>0){o=p-1;do{if(q[o].fn==s){r=true;break}}while(o--)}}if(!r){m.on(t,"keypress",s)}}}},_showMenu:function(r){if(YAHOO.widget.MenuManager){YAHOO.widget.MenuManager.hideVisible()}if(k){k.hideAll()}var n=this._menu,q=this.get("menualignment"),p=this.get("focusmenu"),o;if(this._renderedMenu){n.cfg.setProperty("context",[this.get("element"),q[0],q[1]]);n.cfg.setProperty("preventcontextoverlap",true);n.cfg.setProperty("constraintoviewport",true)}else{n.cfg.queueProperty("context",[this.get("element"),q[0],q[1]]);n.cfg.queueProperty("preventcontextoverlap",true);n.cfg.queueProperty("constraintoviewport",true)}this.focus();if(j&&n&&(n instanceof j)){o=n.focus;n.focus=function(){};if(this._renderedMenu){n.cfg.setProperty("minscrollheight",this.get("menuminscrollheight"));n.cfg.setProperty("maxheight",this.get("menumaxheight"))}else{n.cfg.queueProperty("minscrollheight",this.get("menuminscrollheight"));n.cfg.queueProperty("maxheight",this.get("menumaxheight"))}n.show();n.focus=o;n.align();if(r.type=="mousedown"){m.stopPropagation(r)}if(p){n.focus()}}else{if(b&&n&&(n instanceof b)){if(!this._renderedMenu){n.render(this.get("element").parentNode)}n.show();n.align()}}},_hideMenu:function(){var n=this._menu;if(n){n.hide()}},_onMouseOver:function(o){var q=this.get("type"),n,p;if(q==="split"){n=this.get("element");p=(g.getX(n)+(n.offsetWidth-this.OPTION_AREA_WIDTH));this._nOptionRegionX=p}if(!this._hasMouseEventHandlers){if(q==="split"){this.on("mousemove",this._onMouseMove)}this.on("mouseout",this._onMouseOut);this._hasMouseEventHandlers=true}this.addStateCSSClasses("hover");if(q==="split"&&(m.getPageX(o)>p)){this.addStateCSSClasses("hoveroption")}if(this._activationButtonPressed){this.addStateCSSClasses("active")}if(this._bOptionPressed){this.addStateCSSClasses("activeoption")}if(this.isActive()||this._bOptionPressed){m.removeListener(document,"mouseup",this._onDocumentMouseUp)}},_onMouseMove:function(n){var o=this._nOptionRegionX;if(o){if(m.getPageX(n)>o){this.addStateCSSClasses("hoveroption")}else{this.removeStateCSSClasses("hoveroption")}}},_onMouseOut:function(n){var o=this.get("type");this.removeStateCSSClasses("hover");if(o!="menu"){this.removeStateCSSClasses("active")}if(this.isActive()||this._bOptionPressed){m.on(document,"mouseup",this._onDocumentMouseUp,null,this)}if(o==="split"&&(m.getPageX(n)>this._nOptionRegionX)){this.removeStateCSSClasses("hoveroption")}},_onDocumentMouseUp:function(p){this._activationButtonPressed=false;this._bOptionPressed=false;var q=this.get("type"),n,o;if(q=="menu"||q=="split"){n=m.getTarget(p);o=this._menu.element;if(n!=o&&!g.isAncestor(o,n)){this.removeStateCSSClasses((q=="menu"?"active":"activeoption"));this._hideMenu()}}m.removeListener(document,"mouseup",this._onDocumentMouseUp)},_onMouseDown:function(p){var q,o=true;function n(){this._hideMenu();this.removeListener("mouseup",n)}if((p.which||p.button)==1){if(!this.hasFocus()){i.later(0,this,this.focus)}q=this.get("type");if(q=="split"){if(m.getPageX(p)>this._nOptionRegionX){this.fireEvent("option",p);o=false}else{this.addStateCSSClasses("active");this._activationButtonPressed=true}}else{if(q=="menu"){if(this.isActive()){this._hideMenu();this._activationButtonPressed=false}else{this._showMenu(p);this._activationButtonPressed=true}}else{this.addStateCSSClasses("active");this._activationButtonPressed=true}}if(q=="split"||q=="menu"){this._hideMenuTimer=i.later(250,this,this.on,["mouseup",n])}}return o},_onMouseUp:function(p){this.inMouseDown=false;var q=this.get("type"),n=this._hideMenuTimer,o=true;if(n){n.cancel()}if(q=="checkbox"||q=="radio"){if((p.which||p.button)!=1){return}this.set("checked",!(this.get("checked")))}this._activationButtonPressed=false;if(q!="menu"){this.removeStateCSSClasses("active")}if(q=="split"&&m.getPageX(p)>this._nOptionRegionX){o=false}return o},_onFocus:function(o){var n;this.addStateCSSClasses("focus");if(this._activationKeyPressed){this.addStateCSSClasses("active")}c=this;if(!this._hasKeyEventHandlers){n=this._button;m.on(n,"blur",this._onBlur,null,this);m.on(n,"keydown",this._onKeyDown,null,this);m.on(n,"keyup",this._onKeyUp,null,this);this._hasKeyEventHandlers=true}this.fireEvent("focus",o)},_onBlur:function(n){this.removeStateCSSClasses("focus");if(this.get("type")!="menu"){this.removeStateCSSClasses("active") -}if(this._activationKeyPressed){m.on(document,"keyup",this._onDocumentKeyUp,null,this)}c=null;this.fireEvent("blur",n)},_onDocumentKeyUp:function(n){if(this._isActivationKey(m.getCharCode(n))){this._activationKeyPressed=false;m.removeListener(document,"keyup",this._onDocumentKeyUp)}},_onKeyDown:function(o){var n=this._menu;if(this.get("type")=="split"&&this._isSplitButtonOptionKey(o)){this.fireEvent("option",o)}else{if(this._isActivationKey(m.getCharCode(o))){if(this.get("type")=="menu"){this._showMenu(o)}else{this._activationKeyPressed=true;this.addStateCSSClasses("active")}}}if(n&&n.cfg.getProperty("visible")&&m.getCharCode(o)==27){n.hide();this.focus()}},_onKeyUp:function(n){var o;if(this._isActivationKey(m.getCharCode(n))){o=this.get("type");if(o=="checkbox"||o=="radio"){this.set("checked",!(this.get("checked")))}this._activationKeyPressed=false;if(this.get("type")!="menu"){this.removeStateCSSClasses("active")}}},_onClick:function(p){var r=this.get("type"),q,n,o;switch(r){case"submit":if(p.returnValue!==false){this.submitForm()}break;case"reset":q=this.getForm();if(q){q.reset()}break;case"split":if(this._nOptionRegionX>0&&(m.getPageX(p)>this._nOptionRegionX)){o=false}else{this._hideMenu();n=this.get("srcelement");if(n&&n.type=="submit"&&p.returnValue!==false){this.submitForm()}}break}return o},_onDblClick:function(o){var n=true;if(this.get("type")=="split"&&m.getPageX(o)>this._nOptionRegionX){n=false}return n},_onAppendTo:function(n){i.later(0,this,this._addListenersToForm)},_onFormReset:function(o){var p=this.get("type"),n=this._menu;if(p=="checkbox"||p=="radio"){this.resetValue("checked")}if(j&&n&&(n instanceof j)){this.resetValue("selectedMenuItem")}},_onFormSubmit:function(n){this.createHiddenFields()},_onDocumentMouseDown:function(r){var o=m.getTarget(r),q=this.get("element"),p=this._menu.element;function n(t){var v,s,u;if(!t){return true}for(v=0,s=t.length;v'+(n=="link"?"":'')+"";return o},addStateCSSClasses:function(o){var p=this.get("type"),n=this.CLASS_NAME_PREFIX;if(i.isString(o)){if(o!="activeoption"&&o!="hoveroption"){this.addClass(n+this.CSS_CLASS_NAME+("-"+o))}this.addClass(n+p+("-button-"+o))}},removeStateCSSClasses:function(o){var p=this.get("type"),n=this.CLASS_NAME_PREFIX;if(i.isString(o)){this.removeClass(n+this.CSS_CLASS_NAME+("-"+o));this.removeClass(n+p+("-button-"+o))}},createHiddenFields:function(){this.removeHiddenFields();var v=this.getForm(),z,o,s,x,y,t,u,n,r,w,p,q=false;if(v&&!this.get("disabled")){o=this.get("type");s=(o=="checkbox"||o=="radio");if((s&&this.get("checked"))||(e==this)){YAHOO.log("Creating hidden field.","info",this.toString());z=f((s?o:"hidden"),this.get("name"),this.get("value"),this.get("checked"));if(z){if(s){z.style.display="none"}v.appendChild(z)}}x=this._menu;if(j&&x&&(x instanceof j)){YAHOO.log("Creating hidden field for menu.","info",this.toString());y=this.get("selectedMenuItem");p=x.srcElement;q=(p&&p.nodeName.toUpperCase()=="SELECT");if(y){u=(y.value===null||y.value==="")?y.cfg.getProperty("text"):y.value;t=this.get("name");if(q){w=p.name}else{if(t){w=(t+"_options")}}if(u&&w){n=f("hidden",w,u);v.appendChild(n)}}else{if(q){n=v.appendChild(p)}}}if(z&&n){this._hiddenFields=[z,n]}else{if(!z&&n){this._hiddenFields=n}else{if(z&&!n){this._hiddenFields=z}}}r=this._hiddenFields}return r},removeHiddenFields:function(){var q=this._hiddenFields,o,p;function n(r){if(g.inDocument(r)){r.parentNode.removeChild(r)}}if(q){if(i.isArray(q)){o=q.length;if(o>0){p=o-1;do{n(q[p])}while(p--)}}else{n(q)}this._hiddenFields=null}},submitForm:function(){var q=this.getForm(),p=this.get("srcelement"),o=false,n;if(q){if(this.get("type")=="submit"||(p&&p.type=="submit")){e=this}if(l.ie&&(l.ie<9)){o=q.fireEvent("onsubmit")}else{n=document.createEvent("HTMLEvents");n.initEvent("submit",true,true);o=q.dispatchEvent(n)}if((l.ie||l.webkit)&&o){q.submit()}}return o},init:function(p,D){var v=D.type=="link"?"a":"button",A=D.srcelement,s=p.getElementsByTagName(v)[0],u; -if(!s){u=p.getElementsByTagName("input")[0];if(u){s=document.createElement("button");s.setAttribute("type","button");u.parentNode.replaceChild(s,u)}}this._button=s;YAHOO.widget.Button.superclass.init.call(this,p,D);var t=this.get("id"),z=t+"-button";s.id=z;var x,q;var E=function(F){return(F.htmlFor===t)};var C=function(){q.setAttribute((l.ie?"htmlFor":"for"),z)};if(A&&this.get("type")!="link"){x=g.getElementsBy(E,"label");if(i.isArray(x)&&x.length>0){q=x[0]}}d[t]=this;var B=this.CLASS_NAME_PREFIX;this.addClass(B+this.CSS_CLASS_NAME);this.addClass(B+this.get("type")+"-button");m.on(this._button,"focus",this._onFocus,null,this);this.on("mouseover",this._onMouseOver);this.on("mousedown",this._onMouseDown);this.on("mouseup",this._onMouseUp);this.on("click",this._onClick);var r=this.get("onclick");this.set("onclick",null);this.set("onclick",r);this.on("dblclick",this._onDblClick);var o;if(q){if(this.get("replaceLabel")){this.set("label",q.innerHTML);o=q.parentNode;o.removeChild(q)}else{this.on("appendTo",C);m.on(q,"click",this._onLabelClick,null,this);this._label=q}}this.on("appendTo",this._onAppendTo);var n=this.get("container"),y=this.get("element"),w=g.inDocument(y);if(n){if(A&&A!=y){o=A.parentNode;if(o){o.removeChild(A)}}if(i.isString(n)){m.onContentReady(n,this.appendTo,n,this)}else{this.on("init",function(){i.later(0,this,this.appendTo,n)})}}else{if(!w&&A&&A!=y){o=A.parentNode;if(o){this.fireEvent("beforeAppendTo",{type:"beforeAppendTo",target:o});o.replaceChild(y,A);this.fireEvent("appendTo",{type:"appendTo",target:o})}}else{if(this.get("type")!="link"&&w&&A&&A==y){this._addListenersToForm()}}}YAHOO.log("Initialization completed.","info",this.toString());this.fireEvent("init",{type:"init",target:this})},initAttributes:function(o){var n=o||{};YAHOO.widget.Button.superclass.initAttributes.call(this,n);this.setAttributeConfig("type",{value:(n.type||"push"),validator:i.isString,writeOnce:true,method:this._setType});this.setAttributeConfig("label",{value:n.label,validator:i.isString,method:this._setLabel});this.setAttributeConfig("value",{value:n.value});this.setAttributeConfig("name",{value:n.name,validator:i.isString});this.setAttributeConfig("tabindex",{value:n.tabindex,validator:i.isNumber,method:this._setTabIndex});this.configureAttribute("title",{value:n.title,validator:i.isString,method:this._setTitle});this.setAttributeConfig("disabled",{value:(n.disabled||false),validator:i.isBoolean,method:this._setDisabled});this.setAttributeConfig("href",{value:n.href,validator:i.isString,method:this._setHref});this.setAttributeConfig("target",{value:n.target,validator:i.isString,method:this._setTarget});this.setAttributeConfig("checked",{value:(n.checked||false),validator:i.isBoolean,method:this._setChecked});this.setAttributeConfig("container",{value:n.container,writeOnce:true});this.setAttributeConfig("srcelement",{value:n.srcelement,writeOnce:true});this.setAttributeConfig("menu",{value:null,method:this._setMenu,writeOnce:true});this.setAttributeConfig("lazyloadmenu",{value:(n.lazyloadmenu===false?false:true),validator:i.isBoolean,writeOnce:true});this.setAttributeConfig("menuclassname",{value:(n.menuclassname||(this.CLASS_NAME_PREFIX+"button-menu")),validator:i.isString,method:this._setMenuClassName,writeOnce:true});this.setAttributeConfig("menuminscrollheight",{value:(n.menuminscrollheight||90),validator:i.isNumber});this.setAttributeConfig("menumaxheight",{value:(n.menumaxheight||0),validator:i.isNumber});this.setAttributeConfig("menualignment",{value:(n.menualignment||["tl","bl"]),validator:i.isArray});this.setAttributeConfig("selectedMenuItem",{value:null});this.setAttributeConfig("onclick",{value:n.onclick,method:this._setOnClick});this.setAttributeConfig("focusmenu",{value:(n.focusmenu===false?false:true),validator:i.isBoolean});this.setAttributeConfig("replaceLabel",{value:false,validator:i.isBoolean,writeOnce:true})},focus:function(){if(!this.get("disabled")){try{this._button.focus()}catch(n){}}},blur:function(){if(!this.get("disabled")){try{this._button.blur()}catch(n){}}},hasFocus:function(){return(c==this)},isActive:function(){return this.hasClass(this.CLASS_NAME_PREFIX+this.CSS_CLASS_NAME+"-active")},getMenu:function(){return this._menu},getForm:function(){var n=this._button,o;if(n){o=n.form}return o},getHiddenFields:function(){return this._hiddenFields},destroy:function(){YAHOO.log("Destroying ...","info",this.toString());var p=this.get("element"),n=this._menu,t=this._label,o,s;if(n){YAHOO.log("Destroying menu.","info",this.toString());if(k&&k.find(n)){k.remove(n)}n.destroy()}YAHOO.log("Removing DOM event listeners.","info",this.toString());m.purgeElement(p);m.purgeElement(this._button);m.removeListener(document,"mouseup",this._onDocumentMouseUp);m.removeListener(document,"keyup",this._onDocumentKeyUp);m.removeListener(document,"mousedown",this._onDocumentMouseDown);if(t){m.removeListener(t,"click",this._onLabelClick);o=t.parentNode;o.removeChild(t)}var q=this.getForm();if(q){m.removeListener(q,"reset",this._onFormReset);m.removeListener(q,"submit",this._onFormSubmit)}YAHOO.log("Removing CustomEvent listeners.","info",this.toString());this.unsubscribeAll();o=p.parentNode;if(o){o.removeChild(p)}YAHOO.log("Removing from document.","info",this.toString());delete d[this.get("id")];var r=(this.CLASS_NAME_PREFIX+this.CSS_CLASS_NAME);s=g.getElementsByClassName(r,this.NODE_NAME,q);if(i.isArray(s)&&s.length===0){m.removeListener(q,"keypress",YAHOO.widget.Button.onFormKeyPress)}YAHOO.log("Destroyed.","info",this.toString())},fireEvent:function(o,n){var p=arguments[0];if(this.DOM_EVENTS[p]&&this.get("disabled")){return false}return YAHOO.widget.Button.superclass.fireEvent.apply(this,arguments)},toString:function(){return("Button "+this.get("id"))}});YAHOO.widget.Button.onFormKeyPress=function(r){var p=m.getTarget(r),s=m.getCharCode(r),q=p.nodeName&&p.nodeName.toUpperCase(),n=p.type,t=false,v,x,o,w;function u(A){var z,y;switch(A.nodeName.toUpperCase()){case"INPUT":case"BUTTON":if(A.type=="submit"&&!A.disabled){if(!t&&!o){o=A}}break; -default:z=A.id;if(z){v=d[z];if(v){t=true;if(!v.get("disabled")){y=v.get("srcelement");if(!x&&(v.get("type")=="submit"||(y&&y.type=="submit"))){x=v}}}}break}}if(s==13&&((q=="INPUT"&&(n=="text"||n=="password"||n=="checkbox"||n=="radio"||n=="file"))||q=="SELECT")){g.getElementsBy(u,"*",this);if(o){o.focus()}else{if(!o&&x){m.preventDefault(r);if(l.ie){if(l.ie<9){x.get("element").fireEvent("onclick")}else{w=document.createEvent("HTMLEvents");w.initEvent("click",true,true);x.get("element").dispatchEvent(w)}}else{w=document.createEvent("HTMLEvents");w.initEvent("click",true,true);if(l.gecko<1.9){x.fireEvent("click",w)}else{x.get("element").dispatchEvent(w)}}}}}};YAHOO.widget.Button.addHiddenFieldsToForm=function(n){var r=YAHOO.widget.Button.prototype,t=g.getElementsByClassName((r.CLASS_NAME_PREFIX+r.CSS_CLASS_NAME),"*",n),q=t.length,s,o,p;if(q>0){YAHOO.log("Form contains "+q+" YUI buttons.","info",this.toString());for(p=0;p0){f=h-1;do{this._buttons[f].set("disabled",g)}while(f--)}},_onKeyDown:function(k){var g=b.getTarget(k),i=b.getCharCode(k),h=g.parentNode.parentNode.id,j=e[h],f=-1;if(i==37||i==38){f=(j.index===0)?(this._buttons.length-1):(j.index-1)}else{if(i==39||i==40){f=(j.index===(this._buttons.length-1))?0:(j.index+1)}}if(f>-1){this.check(f);this.getButton(f).focus()}},_onAppendTo:function(h){var j=this._buttons,g=j.length,f;for(f=0;f0){this.logger.log("Found "+j.length+" child nodes with the class name "+k+" Attempting to add to button group.");this.addButtons(j)}this.logger.log('Searching for child nodes with the type of "radio" to add to the button group.');function f(l){return(l.type=="radio")}j=c.getElementsBy(f,"input",this.get("element"));if(j.length>0){this.logger.log("Found "+j.length+' child nodes with the type of "radio." Attempting to add to button group.');this.addButtons(j)}this.on("keydown",this._onKeyDown);this.on("appendTo",this._onAppendTo);var g=this.get("container");if(g){if(d.isString(g)){b.onContentReady(g,function(){this.appendTo(g)},null,this)}else{this.appendTo(g)}}this.logger.log("Initialization completed.")},initAttributes:function(g){var f=g||{};YAHOO.widget.ButtonGroup.superclass.initAttributes.call(this,f);this.setAttributeConfig("name",{value:f.name,validator:d.isString});this.setAttributeConfig("disabled",{value:(f.disabled||false),validator:d.isBoolean,method:this._setDisabled});this.setAttributeConfig("value",{value:f.value});this.setAttributeConfig("container",{value:f.container,writeOnce:true});this.setAttributeConfig("checkedButton",{value:null})},addButton:function(j){var l,k,g,f,h,i;if(j instanceof a&&j.get("type")=="radio"){l=j}else{if(!d.isString(j)&&!j.nodeName){j.type="radio";l=new a(j)}else{l=new a(j,{type:"radio"})}}if(l){f=this._buttons.length;h=l.get("name");i=this.get("name");l.index=f;this._buttons[f]=l;e[l.get("id")]=l;if(h!=i){l.set("name",i)}if(this.get("disabled")){l.set("disabled",true)}if(l.get("checked")){this.set("checkedButton",l)}k=l.get("element");g=this.get("element");if(k.parentNode!=g){g.appendChild(k)}l.on("checkedChange",this._onButtonCheckedChange,l,this);this.logger.log("Button "+l.get("id")+" added.")}return l},addButtons:function(g){var h,j,k,f;if(d.isArray(g)){h=g.length;k=[];if(h>0){for(f=0;f0){f=this._buttons.length-1;do{this._buttons[f].index=f}while(f--)}this.logger.log("Button "+j.get("id")+" removed.")}},getButton:function(f){return this._buttons[f]},getButtons:function(){return this._buttons},getCount:function(){return this._buttons.length},focus:function(h){var j,g,f;if(d.isNumber(h)){j=this._buttons[h];if(j){j.focus()}}else{g=this.getCount();for(f=0; -f0){g=this._buttons.length-1;do{this._buttons[g].destroy()}while(g--)}this.logger.log("Removing DOM event handlers.");b.purgeElement(h);this.logger.log("Removing from document.");f.removeChild(h)},toString:function(){return("ButtonGroup "+this.get("id"))}})})();YAHOO.register("button",YAHOO.widget.Button,{version:"2.9.0",build:"2800"}); \ No newline at end of file +}if(this._activationKeyPressed){m.on(document,"keyup",this._onDocumentKeyUp,null,this)}c=null;this.fireEvent("blur",n)},_onDocumentKeyUp:function(n){if(this._isActivationKey(m.getCharCode(n))){this._activationKeyPressed=false;m.removeListener(document,"keyup",this._onDocumentKeyUp)}},_onKeyDown:function(o){var n=this._menu;if(this.get("type")=="split"&&this._isSplitButtonOptionKey(o)){this.fireEvent("option",o)}else{if(this._isActivationKey(m.getCharCode(o))){if(this.get("type")=="menu"){this._showMenu(o)}else{this._activationKeyPressed=true;this.addStateCSSClasses("active")}}}if(n&&n.cfg.getProperty("visible")&&m.getCharCode(o)==27){n.hide();this.focus()}},_onKeyUp:function(n){var o;if(this._isActivationKey(m.getCharCode(n))){o=this.get("type");if(o=="checkbox"||o=="radio"){this.set("checked",!(this.get("checked")))}this._activationKeyPressed=false;if(this.get("type")!="menu"){this.removeStateCSSClasses("active")}}},_onClick:function(p){var r=this.get("type"),q,n,o;switch(r){case"submit":if(p.returnValue!==false){if(this.submitForm()=="requestSubmit"){m.preventDefault(p)}}break;case"reset":q=this.getForm();if(q){q.reset()}break;case"split":if(this._nOptionRegionX>0&&(m.getPageX(p)>this._nOptionRegionX)){o=false}else{this._hideMenu();n=this.get("srcelement");if(n&&n.type=="submit"&&p.returnValue!==false){this.submitForm()}}break}return o},_onDblClick:function(o){var n=true;if(this.get("type")=="split"&&m.getPageX(o)>this._nOptionRegionX){n=false}return n},_onAppendTo:function(n){i.later(0,this,this._addListenersToForm)},_onFormReset:function(o){var p=this.get("type"),n=this._menu;if(p=="checkbox"||p=="radio"){this.resetValue("checked")}if(j&&n&&(n instanceof j)){this.resetValue("selectedMenuItem")}},_onFormSubmit:function(n){this.createHiddenFields()},_onDocumentMouseDown:function(r){var o=m.getTarget(r),q=this.get("element"),p=this._menu.element;function n(t){var v,s,u;if(!t){return true}for(v=0,s=t.length;v"}else{if(n=="submit"){q=''}else{q=''}}o.innerHTML="<"+p+' class="first-child">'+q+"";return o},addStateCSSClasses:function(o){var p=this.get("type"),n=this.CLASS_NAME_PREFIX;if(i.isString(o)){if(o!="activeoption"&&o!="hoveroption"){this.addClass(n+this.CSS_CLASS_NAME+("-"+o))}this.addClass(n+p+("-button-"+o))}},removeStateCSSClasses:function(o){var p=this.get("type"),n=this.CLASS_NAME_PREFIX;if(i.isString(o)){this.removeClass(n+this.CSS_CLASS_NAME+("-"+o));this.removeClass(n+p+("-button-"+o))}},createHiddenFields:function(){this.removeHiddenFields();var v=this.getForm(),z,o,s,x,y,t,u,n,r,w,p,q=false;if(v&&!this.get("disabled")){o=this.get("type");s=(o=="checkbox"||o=="radio");if((s&&this.get("checked"))||(e==this)){YAHOO.log("Creating hidden field.","info",this.toString());z=f((s?o:"hidden"),this.get("name"),this.get("value"),this.get("checked"));if(z){if(s){z.style.display="none"}v.appendChild(z)}}x=this._menu;if(j&&x&&(x instanceof j)){YAHOO.log("Creating hidden field for menu.","info",this.toString());y=this.get("selectedMenuItem");p=x.srcElement;q=(p&&p.nodeName.toUpperCase()=="SELECT");if(y){u=(y.value===null||y.value==="")?y.cfg.getProperty("text"):y.value;t=this.get("name");if(q){w=p.name}else{if(t){w=(t+"_options")}}if(u&&w){n=f("hidden",w,u);v.appendChild(n)}}else{if(q){n=v.appendChild(p)}}}if(z&&n){this._hiddenFields=[z,n]}else{if(!z&&n){this._hiddenFields=n}else{if(z&&!n){this._hiddenFields=z}}}r=this._hiddenFields}return r},removeHiddenFields:function(){var q=this._hiddenFields,o,p;function n(r){if(g.inDocument(r)){r.parentNode.removeChild(r)}}if(q){if(i.isArray(q)){o=q.length;if(o>0){p=o-1;do{n(q[p])}while(p--)}}else{n(q)}this._hiddenFields=null}},submitForm:function(){var r=this.getForm(),p=this.get("srcelement"),o=false,n;if(r){if(this.get("type")=="submit"||(p&&p.type=="submit")){e=this}if(r.requestSubmit){if(this.get("type")=="submit"){var q=this.getElementsByTagName("button");if(q.length==1&&q[0].type=="submit"){r.requestSubmit(q[0]);return"requestSubmit"}}r.requestSubmit(); +return"requestSubmit"}if(l.ie&&(l.ie<9)){o=r.fireEvent("onsubmit")}else{n=document.createEvent("HTMLEvents");n.initEvent("submit",true,true);o=r.dispatchEvent(n)}if((l.ie||l.webkit)&&o){r.submit()}}return o},init:function(p,D){var v=D.type=="link"?"a":"button",A=D.srcelement,s=p.getElementsByTagName(v)[0],u;if(!s){u=p.getElementsByTagName("input")[0];if(u){s=document.createElement("button");s.setAttribute("type","button");u.parentNode.replaceChild(s,u)}}this._button=s;YAHOO.widget.Button.superclass.init.call(this,p,D);var t=this.get("id"),z=t+"-button";s.id=z;var x,q;var E=function(F){return(F.htmlFor===t)};var C=function(){q.setAttribute((l.ie?"htmlFor":"for"),z)};if(A&&this.get("type")!="link"){x=g.getElementsBy(E,"label");if(i.isArray(x)&&x.length>0){q=x[0]}}d[t]=this;var B=this.CLASS_NAME_PREFIX;this.addClass(B+this.CSS_CLASS_NAME);this.addClass(B+this.get("type")+"-button");m.on(this._button,"focus",this._onFocus,null,this);this.on("mouseover",this._onMouseOver);this.on("mousedown",this._onMouseDown);this.on("mouseup",this._onMouseUp);this.on("click",this._onClick);var r=this.get("onclick");this.set("onclick",null);this.set("onclick",r);this.on("dblclick",this._onDblClick);var o;if(q){if(this.get("replaceLabel")){this.set("label",q.innerHTML);o=q.parentNode;o.removeChild(q)}else{this.on("appendTo",C);m.on(q,"click",this._onLabelClick,null,this);this._label=q}}this.on("appendTo",this._onAppendTo);var n=this.get("container"),y=this.get("element"),w=g.inDocument(y);if(n){if(A&&A!=y){o=A.parentNode;if(o){o.removeChild(A)}}if(i.isString(n)){m.onContentReady(n,this.appendTo,n,this)}else{this.on("init",function(){i.later(0,this,this.appendTo,n)})}}else{if(!w&&A&&A!=y){o=A.parentNode;if(o){this.fireEvent("beforeAppendTo",{type:"beforeAppendTo",target:o});o.replaceChild(y,A);this.fireEvent("appendTo",{type:"appendTo",target:o})}}else{if(this.get("type")!="link"&&w&&A&&A==y){this._addListenersToForm()}}}YAHOO.log("Initialization completed.","info",this.toString());this.fireEvent("init",{type:"init",target:this})},initAttributes:function(o){var n=o||{};YAHOO.widget.Button.superclass.initAttributes.call(this,n);this.setAttributeConfig("type",{value:(n.type||"push"),validator:i.isString,writeOnce:true,method:this._setType});this.setAttributeConfig("label",{value:n.label,validator:i.isString,method:this._setLabel});this.setAttributeConfig("value",{value:n.value});this.setAttributeConfig("name",{value:n.name,validator:i.isString});this.setAttributeConfig("tabindex",{value:n.tabindex,validator:i.isNumber,method:this._setTabIndex});this.configureAttribute("title",{value:n.title,validator:i.isString,method:this._setTitle});this.setAttributeConfig("disabled",{value:(n.disabled||false),validator:i.isBoolean,method:this._setDisabled});this.setAttributeConfig("href",{value:n.href,validator:i.isString,method:this._setHref});this.setAttributeConfig("target",{value:n.target,validator:i.isString,method:this._setTarget});this.setAttributeConfig("checked",{value:(n.checked||false),validator:i.isBoolean,method:this._setChecked});this.setAttributeConfig("container",{value:n.container,writeOnce:true});this.setAttributeConfig("srcelement",{value:n.srcelement,writeOnce:true});this.setAttributeConfig("menu",{value:null,method:this._setMenu,writeOnce:true});this.setAttributeConfig("lazyloadmenu",{value:(n.lazyloadmenu===false?false:true),validator:i.isBoolean,writeOnce:true});this.setAttributeConfig("menuclassname",{value:(n.menuclassname||(this.CLASS_NAME_PREFIX+"button-menu")),validator:i.isString,method:this._setMenuClassName,writeOnce:true});this.setAttributeConfig("menuminscrollheight",{value:(n.menuminscrollheight||90),validator:i.isNumber});this.setAttributeConfig("menumaxheight",{value:(n.menumaxheight||0),validator:i.isNumber});this.setAttributeConfig("menualignment",{value:(n.menualignment||["tl","bl"]),validator:i.isArray});this.setAttributeConfig("selectedMenuItem",{value:null});this.setAttributeConfig("onclick",{value:n.onclick,method:this._setOnClick});this.setAttributeConfig("focusmenu",{value:(n.focusmenu===false?false:true),validator:i.isBoolean});this.setAttributeConfig("replaceLabel",{value:false,validator:i.isBoolean,writeOnce:true})},focus:function(){if(!this.get("disabled")){try{this._button.focus()}catch(n){}}},blur:function(){if(!this.get("disabled")){try{this._button.blur()}catch(n){}}},hasFocus:function(){return(c==this)},isActive:function(){return this.hasClass(this.CLASS_NAME_PREFIX+this.CSS_CLASS_NAME+"-active")},getMenu:function(){return this._menu},getForm:function(){var n=this._button,o;if(n){o=n.form}return o},getHiddenFields:function(){return this._hiddenFields},destroy:function(){YAHOO.log("Destroying ...","info",this.toString());var p=this.get("element"),n=this._menu,t=this._label,o,s;if(n){YAHOO.log("Destroying menu.","info",this.toString());if(k&&k.find(n)){k.remove(n)}n.destroy()}YAHOO.log("Removing DOM event listeners.","info",this.toString());m.purgeElement(p);m.purgeElement(this._button);m.removeListener(document,"mouseup",this._onDocumentMouseUp);m.removeListener(document,"keyup",this._onDocumentKeyUp);m.removeListener(document,"mousedown",this._onDocumentMouseDown);if(t){m.removeListener(t,"click",this._onLabelClick);o=t.parentNode;o.removeChild(t)}var q=this.getForm();if(q){m.removeListener(q,"reset",this._onFormReset);m.removeListener(q,"submit",this._onFormSubmit)}YAHOO.log("Removing CustomEvent listeners.","info",this.toString());this.unsubscribeAll();o=p.parentNode;if(o){o.removeChild(p)}YAHOO.log("Removing from document.","info",this.toString());delete d[this.get("id")];var r=(this.CLASS_NAME_PREFIX+this.CSS_CLASS_NAME);s=g.getElementsByClassName(r,this.NODE_NAME,q);if(i.isArray(s)&&s.length===0){m.removeListener(q,"keypress",YAHOO.widget.Button.onFormKeyPress)}YAHOO.log("Destroyed.","info",this.toString())},fireEvent:function(o,n){var p=arguments[0];if(this.DOM_EVENTS[p]&&this.get("disabled")){return false}return YAHOO.widget.Button.superclass.fireEvent.apply(this,arguments)},toString:function(){return("Button "+this.get("id")) +}});YAHOO.widget.Button.onFormKeyPress=function(r){var p=m.getTarget(r),s=m.getCharCode(r),q=p.nodeName&&p.nodeName.toUpperCase(),n=p.type,t=false,v,x,o,w;function u(A){var z,y;switch(A.nodeName.toUpperCase()){case"INPUT":case"BUTTON":if(A.type=="submit"&&!A.disabled){if(!t&&!o){o=A}}break;default:z=A.id;if(z){v=d[z];if(v){t=true;if(!v.get("disabled")){y=v.get("srcelement");if(!x&&(v.get("type")=="submit"||(y&&y.type=="submit"))){x=v}}}}break}}if(s==13&&((q=="INPUT"&&(n=="text"||n=="password"||n=="checkbox"||n=="radio"||n=="file"))||q=="SELECT")){g.getElementsBy(u,"*",this);if(o){o.focus()}else{if(!o&&x){m.preventDefault(r);if(l.ie){if(l.ie<9){x.get("element").fireEvent("onclick")}else{w=document.createEvent("HTMLEvents");w.initEvent("click",true,true);x.get("element").dispatchEvent(w)}}else{w=document.createEvent("HTMLEvents");w.initEvent("click",true,true);if(l.gecko<1.9){x.fireEvent("click",w)}else{x.get("element").dispatchEvent(w)}}}}}};YAHOO.widget.Button.addHiddenFieldsToForm=function(n){var r=YAHOO.widget.Button.prototype,t=g.getElementsByClassName((r.CLASS_NAME_PREFIX+r.CSS_CLASS_NAME),"*",n),q=t.length,s,o,p;if(q>0){YAHOO.log("Form contains "+q+" YUI buttons.","info",this.toString());for(p=0;p0){f=h-1;do{this._buttons[f].set("disabled",g)}while(f--)}},_onKeyDown:function(k){var g=b.getTarget(k),i=b.getCharCode(k),h=g.parentNode.parentNode.id,j=e[h],f=-1;if(i==37||i==38){f=(j.index===0)?(this._buttons.length-1):(j.index-1)}else{if(i==39||i==40){f=(j.index===(this._buttons.length-1))?0:(j.index+1)}}if(f>-1){this.check(f);this.getButton(f).focus()}},_onAppendTo:function(h){var j=this._buttons,g=j.length,f;for(f=0;f0){this.logger.log("Found "+j.length+" child nodes with the class name "+k+" Attempting to add to button group.");this.addButtons(j)}this.logger.log('Searching for child nodes with the type of "radio" to add to the button group.');function f(l){return(l.type=="radio")}j=c.getElementsBy(f,"input",this.get("element"));if(j.length>0){this.logger.log("Found "+j.length+' child nodes with the type of "radio." Attempting to add to button group.');this.addButtons(j)}this.on("keydown",this._onKeyDown);this.on("appendTo",this._onAppendTo);var g=this.get("container");if(g){if(d.isString(g)){b.onContentReady(g,function(){this.appendTo(g)},null,this)}else{this.appendTo(g)}}this.logger.log("Initialization completed.")},initAttributes:function(g){var f=g||{};YAHOO.widget.ButtonGroup.superclass.initAttributes.call(this,f);this.setAttributeConfig("name",{value:f.name,validator:d.isString});this.setAttributeConfig("disabled",{value:(f.disabled||false),validator:d.isBoolean,method:this._setDisabled});this.setAttributeConfig("value",{value:f.value});this.setAttributeConfig("container",{value:f.container,writeOnce:true});this.setAttributeConfig("checkedButton",{value:null})},addButton:function(j){var l,k,g,f,h,i;if(j instanceof a&&j.get("type")=="radio"){l=j}else{if(!d.isString(j)&&!j.nodeName){j.type="radio";l=new a(j)}else{l=new a(j,{type:"radio"})}}if(l){f=this._buttons.length;h=l.get("name");i=this.get("name");l.index=f;this._buttons[f]=l;e[l.get("id")]=l;if(h!=i){l.set("name",i)}if(this.get("disabled")){l.set("disabled",true)}if(l.get("checked")){this.set("checkedButton",l)}k=l.get("element");g=this.get("element");if(k.parentNode!=g){g.appendChild(k)}l.on("checkedChange",this._onButtonCheckedChange,l,this);this.logger.log("Button "+l.get("id")+" added.")}return l},addButtons:function(g){var h,j,k,f;if(d.isArray(g)){h=g.length;k=[];if(h>0){for(f=0;f0){f=this._buttons.length-1;do{this._buttons[f].index=f}while(f--)}this.logger.log("Button "+j.get("id")+" removed.") +}},getButton:function(f){return this._buttons[f]},getButtons:function(){return this._buttons},getCount:function(){return this._buttons.length},focus:function(h){var j,g,f;if(d.isNumber(h)){j=this._buttons[h];if(j){j.focus()}}else{g=this.getCount();for(f=0;f0){g=this._buttons.length-1;do{this._buttons[g].destroy()}while(g--)}this.logger.log("Removing DOM event handlers.");b.purgeElement(h);this.logger.log("Removing from document.");f.removeChild(h)},toString:function(){return("ButtonGroup "+this.get("id"))}})})();YAHOO.register("button",YAHOO.widget.Button,{version:"2.9.0",build:"2800"}); \ No newline at end of file