import v1.1.0_beta1 | 2009-08-21

This commit is contained in:
2019-07-17 22:16:19 +02:00
parent 2c1152f0d3
commit 8dee6b1a10
2306 changed files with 251360 additions and 23428 deletions

View File

@ -1,8 +1,8 @@
/*
Copyright (c) 2008, Yahoo! Inc. All rights reserved.
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.6.0
version: 2.7.0
*/
.yui-button {

View File

@ -1,8 +1,8 @@
/*
Copyright (c) 2008, Yahoo! Inc. All rights reserved.
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.6.0
version: 2.7.0
*/
.yui-skin-sam .yui-button {
@ -20,15 +20,13 @@ version: 2.6.0
border-style: solid;
border-color: #808080;
margin: 0 -1px;
*position: relative; /* Necessary to get negative margins working in IE */
*left: -1px;
/*
Don't apply rounded corners for IE 6 (Quirks and Standards Mode) and IE 7 Quirks Mode
since it causes more problems than its worth.
/*
Using negative margins for rounded corners won't work in IE 6 and IE 7
(Quirks Mode Only), so set the "margin" property to "0" for those
browsers.
*/
_margin: 0;
_position: static;
_margin: 0;
}

View File

@ -1,7 +1,7 @@
/*
Copyright (c) 2008, Yahoo! Inc. All rights reserved.
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.6.0
version: 2.7.0
*/
.yui-button{display:-moz-inline-box;display:inline-block;vertical-align:text-bottom;}.yui-button .first-child{display:block;*display:inline-block;}.yui-button button,.yui-button a{display:block;*display:inline-block;border:none;margin:0;}.yui-button button{background-color:transparent;*overflow:visible;cursor:pointer;}.yui-button a{text-decoration:none;}.yui-skin-sam .yui-button{border-width:1px 0;border-style:solid;border-color:#808080;background:url(../../../../assets/skins/sam/sprite.png) repeat-x 0 0;margin:auto .25em;}.yui-skin-sam .yui-button .first-child{border-width:0 1px;border-style:solid;border-color:#808080;margin:0 -1px;*position:relative;*left:-1px;_margin:0;_position:static;}.yui-skin-sam .yui-button button,.yui-skin-sam .yui-button a{padding:0 10px;font-size:93%;line-height:2;*line-height:1.7;min-height:2em;*min-height:auto;color:#000;}.yui-skin-sam .yui-button a{*line-height:1.875;*padding-bottom:1px;}.yui-skin-sam .yui-split-button button,.yui-skin-sam .yui-menu-button button{padding-right:20px;background-position:right center;background-repeat:no-repeat;}.yui-skin-sam .yui-menu-button button{background-image:url(menu-button-arrow.png);}.yui-skin-sam .yui-split-button button{background-image:url(split-button-arrow.png);}.yui-skin-sam .yui-button-focus{border-color:#7D98B8;background-position:0 -1300px;}.yui-skin-sam .yui-button-focus .first-child{border-color:#7D98B8;}.yui-skin-sam .yui-button-focus button,.yui-skin-sam .yui-button-focus a{color:#000;}.yui-skin-sam .yui-split-button-focus button{background-image:url(split-button-arrow-focus.png);}.yui-skin-sam .yui-button-hover{border-color:#7D98B8;background-position:0 -1300px;}.yui-skin-sam .yui-button-hover .first-child{border-color:#7D98B8;}.yui-skin-sam .yui-button-hover button,.yui-skin-sam .yui-button-hover a{color:#000;}.yui-skin-sam .yui-split-button-hover button{background-image:url(split-button-arrow-hover.png);}.yui-skin-sam .yui-button-active{border-color:#7D98B8;background-position:0 -1700px;}.yui-skin-sam .yui-button-active .first-child{border-color:#7D98B8;}.yui-skin-sam .yui-button-active button,.yui-skin-sam .yui-button-active a{color:#000;}.yui-skin-sam .yui-split-button-activeoption{border-color:#808080;background-position:0 0;}.yui-skin-sam .yui-split-button-activeoption .first-child{border-color:#808080;}.yui-skin-sam .yui-split-button-activeoption button{background-image:url(split-button-arrow-active.png);}.yui-skin-sam .yui-radio-button-checked,.yui-skin-sam .yui-checkbox-button-checked{border-color:#304369;background-position:0 -1400px;}.yui-skin-sam .yui-radio-button-checked .first-child,.yui-skin-sam .yui-checkbox-button-checked .first-child{border-color:#304369;}.yui-skin-sam .yui-radio-button-checked button,.yui-skin-sam .yui-checkbox-button-checked button{color:#fff;}.yui-skin-sam .yui-button-disabled{border-color:#ccc;background-position:0 -1500px;}.yui-skin-sam .yui-button-disabled .first-child{border-color:#ccc;}.yui-skin-sam .yui-button-disabled button,.yui-skin-sam .yui-button-disabled a{color:#A6A6A6;cursor:default;}.yui-skin-sam .yui-menu-button-disabled button{background-image:url(menu-button-arrow-disabled.png);}.yui-skin-sam .yui-split-button-disabled button{background-image:url(split-button-arrow-disabled.png);}
.yui-button{display:-moz-inline-box;display:inline-block;vertical-align:text-bottom;}.yui-button .first-child{display:block;*display:inline-block;}.yui-button button,.yui-button a{display:block;*display:inline-block;border:none;margin:0;}.yui-button button{background-color:transparent;*overflow:visible;cursor:pointer;}.yui-button a{text-decoration:none;}.yui-skin-sam .yui-button{border-width:1px 0;border-style:solid;border-color:#808080;background:url(../../../../assets/skins/sam/sprite.png) repeat-x 0 0;margin:auto .25em;}.yui-skin-sam .yui-button .first-child{border-width:0 1px;border-style:solid;border-color:#808080;margin:0 -1px;_margin:0;}.yui-skin-sam .yui-button button,.yui-skin-sam .yui-button a{padding:0 10px;font-size:93%;line-height:2;*line-height:1.7;min-height:2em;*min-height:auto;color:#000;}.yui-skin-sam .yui-button a{*line-height:1.875;*padding-bottom:1px;}.yui-skin-sam .yui-split-button button,.yui-skin-sam .yui-menu-button button{padding-right:20px;background-position:right center;background-repeat:no-repeat;}.yui-skin-sam .yui-menu-button button{background-image:url(menu-button-arrow.png);}.yui-skin-sam .yui-split-button button{background-image:url(split-button-arrow.png);}.yui-skin-sam .yui-button-focus{border-color:#7D98B8;background-position:0 -1300px;}.yui-skin-sam .yui-button-focus .first-child{border-color:#7D98B8;}.yui-skin-sam .yui-button-focus button,.yui-skin-sam .yui-button-focus a{color:#000;}.yui-skin-sam .yui-split-button-focus button{background-image:url(split-button-arrow-focus.png);}.yui-skin-sam .yui-button-hover{border-color:#7D98B8;background-position:0 -1300px;}.yui-skin-sam .yui-button-hover .first-child{border-color:#7D98B8;}.yui-skin-sam .yui-button-hover button,.yui-skin-sam .yui-button-hover a{color:#000;}.yui-skin-sam .yui-split-button-hover button{background-image:url(split-button-arrow-hover.png);}.yui-skin-sam .yui-button-active{border-color:#7D98B8;background-position:0 -1700px;}.yui-skin-sam .yui-button-active .first-child{border-color:#7D98B8;}.yui-skin-sam .yui-button-active button,.yui-skin-sam .yui-button-active a{color:#000;}.yui-skin-sam .yui-split-button-activeoption{border-color:#808080;background-position:0 0;}.yui-skin-sam .yui-split-button-activeoption .first-child{border-color:#808080;}.yui-skin-sam .yui-split-button-activeoption button{background-image:url(split-button-arrow-active.png);}.yui-skin-sam .yui-radio-button-checked,.yui-skin-sam .yui-checkbox-button-checked{border-color:#304369;background-position:0 -1400px;}.yui-skin-sam .yui-radio-button-checked .first-child,.yui-skin-sam .yui-checkbox-button-checked .first-child{border-color:#304369;}.yui-skin-sam .yui-radio-button-checked button,.yui-skin-sam .yui-checkbox-button-checked button{color:#fff;}.yui-skin-sam .yui-button-disabled{border-color:#ccc;background-position:0 -1500px;}.yui-skin-sam .yui-button-disabled .first-child{border-color:#ccc;}.yui-skin-sam .yui-button-disabled button,.yui-skin-sam .yui-button-disabled a{color:#A6A6A6;cursor:default;}.yui-skin-sam .yui-menu-button-disabled button{background-image:url(menu-button-arrow-disabled.png);}.yui-skin-sam .yui-split-button-disabled button{background-image:url(split-button-arrow-disabled.png);}

View File

@ -1,14 +1,14 @@
/*
Copyright (c) 2008, Yahoo! Inc. All rights reserved.
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.6.0
version: 2.7.0
*/
/**
* @module button
* @description <p>The Button Control enables the creation of rich, graphical
* buttons that function like traditional HTML form buttons. <em>Unlike</em>
* tradition HTML form buttons, buttons created with the Button Control can have
* traditional HTML form buttons, buttons created with the Button Control can have
* a label that is different from its value. With the inclusion of the optional
* <a href="module_menu.html">Menu Control</a>, the Button Control can also be
* used to create menu buttons and split buttons, controls that are not
@ -1060,7 +1060,7 @@ version: 2.6.0
}
},
/**
* @method _setMenu
@ -1081,15 +1081,9 @@ version: 2.6.0
*/
bInstance = false,
oMenu,
oMenuElement,
oSrcElement,
aItems,
nItems,
oItem,
i;
oSrcElement;
function onAppendTo() {
@ -1147,12 +1141,13 @@ version: 2.6.0
oMenu.keyDownEvent.subscribe(this._onMenuKeyDown, this, true);
oMenu.subscribe("click", this._onMenuClick, this, true);
oMenu.itemAddedEvent.subscribe(this._onMenuItemAdded, this, true);
this.on("selectedMenuItemChange", this._onSelectedMenuItemChange);
oSrcElement = oMenu.srcElement;
if (oSrcElement && oSrcElement.nodeName.toUpperCase() == "SELECT") {
oSrcElement.style.display = "none";
oSrcElement.parentNode.removeChild(oSrcElement);
@ -1206,31 +1201,8 @@ version: 2.6.0
if (p_oMenu && Menu && (p_oMenu instanceof Menu)) {
oMenu = p_oMenu;
aItems = oMenu.getItems();
nItems = aItems.length;
bInstance = true;
if (nItems > 0) {
i = nItems - 1;
do {
oItem = aItems[i];
if (oItem) {
oItem.cfg.subscribeToConfigEvent("selected",
this._onMenuItemSelected, oItem, this);
}
}
while (i--);
}
initMenu.call(this);
}
@ -1344,36 +1316,7 @@ version: 2.6.0
}
},
/**
* @method _setSelectedMenuItem
* @description Sets the value of the button's
* "selectedMenuItem" attribute.
* @protected
* @param {Number} p_nIndex Number representing the index of the item
* in the button's menu that is currently selected.
*/
_setSelectedMenuItem: function (p_nIndex) {
var oMenu = this._menu,
oMenuItem;
if (Menu && oMenu && oMenu instanceof Menu) {
oMenuItem = oMenu.getItem(p_nIndex);
if (oMenuItem && !oMenuItem.cfg.getProperty("selected")) {
oMenuItem.cfg.setProperty("selected", true);
}
}
},
// Protected methods
@ -2176,98 +2119,100 @@ version: 2.6.0
bReturnVal;
switch (sType) {
case "radio":
case "checkbox":
switch (sType) {
case "radio":
case "checkbox":
if (!this._hasDefaultTitle) {
if (this.get("checked")) {
sTitle = (sType == "radio") ?
this.RADIO_CHECKED_TITLE :
this.CHECKBOX_CHECKED_TITLE;
}
else {
sTitle = (sType == "radio") ?
this.RADIO_DEFAULT_TITLE :
this.CHECKBOX_DEFAULT_TITLE;
}
this.set("title", sTitle);
}
break;
case "submit":
}
break;
case "submit":
if (p_oEvent.returnValue !== false) {
this.submitForm();
}
break;
case "reset":
oForm = this.getForm();
if (oForm) {
oForm.reset();
}
break;
case "menu":
sTitle = this._menu.cfg.getProperty("visible") ?
this.MENUBUTTON_MENU_VISIBLE_TITLE :
this.MENUBUTTON_DEFAULT_TITLE;
this.set("title", sTitle);
break;
case "split":
if (Event.getPageX(p_oEvent) > this._nOptionRegionX) {
bReturnVal = false;
}
else {
this._hideMenu();
oSrcElement = this.get("srcelement");
if (oSrcElement && oSrcElement.type == "submit") {
this.submitForm();
}
}
sTitle = this._menu.cfg.getProperty("visible") ?
this.SPLITBUTTON_OPTION_VISIBLE_TITLE :
this.SPLITBUTTON_DEFAULT_TITLE;
this.set("title", sTitle);
break;
}
return bReturnVal;
this.submitForm();
}
break;
case "reset":
oForm = this.getForm();
if (oForm) {
oForm.reset();
}
break;
case "menu":
sTitle = this._menu.cfg.getProperty("visible") ?
this.MENUBUTTON_MENU_VISIBLE_TITLE :
this.MENUBUTTON_DEFAULT_TITLE;
this.set("title", sTitle);
break;
case "split":
if (this._nOptionRegionX > 0 &&
(Event.getPageX(p_oEvent) > this._nOptionRegionX)) {
bReturnVal = false;
}
else {
this._hideMenu();
oSrcElement = this.get("srcelement");
if (oSrcElement && oSrcElement.type == "submit" &&
p_oEvent.returnValue !== false) {
this.submitForm();
}
}
sTitle = this._menu.cfg.getProperty("visible") ?
this.SPLITBUTTON_OPTION_VISIBLE_TITLE :
this.SPLITBUTTON_DEFAULT_TITLE;
this.set("title", sTitle);
break;
}
return bReturnVal;
},
@ -2526,7 +2471,9 @@ version: 2.6.0
var oButtonElement = this.get("element"),
oButtonParent = oButtonElement.parentNode,
oMenuElement = this._menu.element;
oMenu = this._menu,
oMenuElement = oMenu.element,
oSrcElement = oMenu.srcElement;
if (oButtonParent != oMenuElement.parentNode) {
@ -2537,55 +2484,21 @@ version: 2.6.0
this._renderedMenu = true;
this.set("selectedMenuItem", this.get("selectedMenuItem"));
// If the user has designated an <option> of the Menu's source
// <select> element to be selected, sync the selectedIndex with
// the "selectedMenuItem" Attribute.
if (oSrcElement &&
oSrcElement.nodeName.toLowerCase() === "select" &&
oSrcElement.value) {
this.set("selectedMenuItem",
oMenu.getItem(oSrcElement.selectedIndex));
}
},
/**
* @method _onMenuItemSelected
* @description "selectedchange" event handler for each item in the
* button's menu.
* @private
* @param {String} p_sType String representing the name of the event
* that was fired.
* @param {Array} p_aArgs Array of arguments sent when the event
* was fired.
* @param {MenuItem} p_oItem Object representing the menu item that
* subscribed to the event.
*/
_onMenuItemSelected: function (p_sType, p_aArgs, p_oItem) {
var bSelected = p_aArgs[0];
if (bSelected) {
this.set("selectedMenuItem", p_oItem);
}
},
/**
* @method _onMenuItemAdded
* @description "itemadded" event handler for the button's menu.
* @private
* @param {String} p_sType String representing the name of the event
* that was fired.
* @param {Array} p_aArgs Array of arguments sent when the event
* was fired.
* @param {<a href="YAHOO.widget.MenuItem.html">
* YAHOO.widget.MenuItem</a>} p_oItem Object representing the menu
* item that subscribed to the event.
*/
_onMenuItemAdded: function (p_sType, p_aArgs, p_oItem) {
var oItem = p_aArgs[0];
oItem.cfg.subscribeToConfigEvent("selected", this._onMenuItemSelected, oItem, this);
},
/**
@ -2619,7 +2532,29 @@ version: 2.6.0
}
},
/**
* @method _onSelectedMenuItemChange
* @description "selectedMenuItemChange" event handler for the Button's
* "selectedMenuItem" attribute.
* @param {Event} event Object representing the DOM event object
* passed back by the event utility (YAHOO.util.Event).
*/
_onSelectedMenuItemChange: function (event) {
var oSelected = event.prevValue,
oItem = event.newValue;
if (oSelected) {
Dom.removeClass(oSelected.element, "yui-button-selectedmenuitem");
}
if (oItem) {
Dom.addClass(oItem.element, "yui-button-selectedmenuitem");
}
},
// Public methods
@ -3048,6 +2983,16 @@ version: 2.6.0
this.on("mousedown", this._onMouseDown);
this.on("mouseup", this._onMouseUp);
this.on("click", this._onClick);
// Need to reset the value of the "onclick" Attribute so that any
// handlers registered via the "onclick" Attribute are fired after
// Button's default "_onClick" listener.
var fnOnClick = this.get("onclick");
this.set("onclick", null);
this.set("onclick", fnOnClick);
this.on("dblclick", this._onDblClick);
if (oLabel) {
@ -3157,6 +3102,7 @@ version: 2.6.0
* "radio," "menu," and "split."
* @default "push"
* @type String
* @writeonce
*/
this.setAttributeConfig("type", {
@ -3164,7 +3110,7 @@ version: 2.6.0
validator: Lang.isString,
writeOnce: true,
method: this._setType
});
@ -3312,6 +3258,7 @@ version: 2.6.0
* @type <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/
* level-one-html.html#ID-58190037">HTMLElement</a>|String
* @default null
* @writeonce
*/
this.setAttributeConfig("container", {
@ -3329,6 +3276,7 @@ version: 2.6.0
* @type <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/
* level-one-html.html#ID-58190037">HTMLElement</a>|String
* @default null
* @writeonce
*/
this.setAttributeConfig("srcelement", {
@ -3372,6 +3320,7 @@ version: 2.6.0
* href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-
* one-html.html#ID-58190037">HTMLElement</a>|String|Array
* @default null
* @writeonce
*/
this.setAttributeConfig("menu", {
@ -3405,6 +3354,7 @@ version: 2.6.0
* attribute.</em>
* @default true
* @type Boolean
* @writeonce
*/
this.setAttributeConfig("lazyloadmenu", {
@ -3421,6 +3371,7 @@ version: 2.6.0
* applied to the root element of the button's menu.
* @type String
* @default "yui-button-menu"
* @writeonce
*/
this.setAttributeConfig("menuclassname", {
@ -3491,8 +3442,7 @@ version: 2.6.0
*/
this.setAttributeConfig("selectedMenuItem", {
value: null,
method: this._setSelectedMenuItem
value: null
});
@ -4469,6 +4419,7 @@ version: 2.6.0
* @type <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/
* level-one-html.html#ID-58190037">HTMLElement</a>|String
* @default null
* @writeonce
*/
this.setAttributeConfig("container", {
@ -4856,4 +4807,4 @@ version: 2.6.0
});
})();
YAHOO.register("button", YAHOO.widget.Button, {version: "2.6.0", build: "1321"});
YAHOO.register("button", YAHOO.widget.Button, {version: "2.7.0", build: "1799"});

File diff suppressed because one or more lines are too long

View File

@ -1,14 +1,14 @@
/*
Copyright (c) 2008, Yahoo! Inc. All rights reserved.
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.6.0
version: 2.7.0
*/
/**
* @module button
* @description <p>The Button Control enables the creation of rich, graphical
* buttons that function like traditional HTML form buttons. <em>Unlike</em>
* tradition HTML form buttons, buttons created with the Button Control can have
* traditional HTML form buttons, buttons created with the Button Control can have
* a label that is different from its value. With the inclusion of the optional
* <a href="module_menu.html">Menu Control</a>, the Button Control can also be
* used to create menu buttons and split buttons, controls that are not
@ -1039,7 +1039,7 @@ version: 2.6.0
}
},
/**
* @method _setMenu
@ -1060,15 +1060,9 @@ version: 2.6.0
*/
bInstance = false,
oMenu,
oMenuElement,
oSrcElement,
aItems,
nItems,
oItem,
i;
oSrcElement;
function onAppendTo() {
@ -1126,12 +1120,13 @@ version: 2.6.0
oMenu.keyDownEvent.subscribe(this._onMenuKeyDown, this, true);
oMenu.subscribe("click", this._onMenuClick, this, true);
oMenu.itemAddedEvent.subscribe(this._onMenuItemAdded, this, true);
this.on("selectedMenuItemChange", this._onSelectedMenuItemChange);
oSrcElement = oMenu.srcElement;
if (oSrcElement && oSrcElement.nodeName.toUpperCase() == "SELECT") {
oSrcElement.style.display = "none";
oSrcElement.parentNode.removeChild(oSrcElement);
@ -1185,31 +1180,8 @@ version: 2.6.0
if (p_oMenu && Menu && (p_oMenu instanceof Menu)) {
oMenu = p_oMenu;
aItems = oMenu.getItems();
nItems = aItems.length;
bInstance = true;
if (nItems > 0) {
i = nItems - 1;
do {
oItem = aItems[i];
if (oItem) {
oItem.cfg.subscribeToConfigEvent("selected",
this._onMenuItemSelected, oItem, this);
}
}
while (i--);
}
initMenu.call(this);
}
@ -1323,36 +1295,7 @@ version: 2.6.0
}
},
/**
* @method _setSelectedMenuItem
* @description Sets the value of the button's
* "selectedMenuItem" attribute.
* @protected
* @param {Number} p_nIndex Number representing the index of the item
* in the button's menu that is currently selected.
*/
_setSelectedMenuItem: function (p_nIndex) {
var oMenu = this._menu,
oMenuItem;
if (Menu && oMenu && oMenu instanceof Menu) {
oMenuItem = oMenu.getItem(p_nIndex);
if (oMenuItem && !oMenuItem.cfg.getProperty("selected")) {
oMenuItem.cfg.setProperty("selected", true);
}
}
},
// Protected methods
@ -2155,98 +2098,100 @@ version: 2.6.0
bReturnVal;
switch (sType) {
case "radio":
case "checkbox":
switch (sType) {
case "radio":
case "checkbox":
if (!this._hasDefaultTitle) {
if (this.get("checked")) {
sTitle = (sType == "radio") ?
this.RADIO_CHECKED_TITLE :
this.CHECKBOX_CHECKED_TITLE;
}
else {
sTitle = (sType == "radio") ?
this.RADIO_DEFAULT_TITLE :
this.CHECKBOX_DEFAULT_TITLE;
}
this.set("title", sTitle);
}
break;
case "submit":
}
break;
case "submit":
if (p_oEvent.returnValue !== false) {
this.submitForm();
}
break;
case "reset":
oForm = this.getForm();
if (oForm) {
oForm.reset();
}
break;
case "menu":
sTitle = this._menu.cfg.getProperty("visible") ?
this.MENUBUTTON_MENU_VISIBLE_TITLE :
this.MENUBUTTON_DEFAULT_TITLE;
this.set("title", sTitle);
break;
case "split":
if (Event.getPageX(p_oEvent) > this._nOptionRegionX) {
bReturnVal = false;
}
else {
this._hideMenu();
oSrcElement = this.get("srcelement");
if (oSrcElement && oSrcElement.type == "submit") {
this.submitForm();
}
}
sTitle = this._menu.cfg.getProperty("visible") ?
this.SPLITBUTTON_OPTION_VISIBLE_TITLE :
this.SPLITBUTTON_DEFAULT_TITLE;
this.set("title", sTitle);
break;
}
return bReturnVal;
this.submitForm();
}
break;
case "reset":
oForm = this.getForm();
if (oForm) {
oForm.reset();
}
break;
case "menu":
sTitle = this._menu.cfg.getProperty("visible") ?
this.MENUBUTTON_MENU_VISIBLE_TITLE :
this.MENUBUTTON_DEFAULT_TITLE;
this.set("title", sTitle);
break;
case "split":
if (this._nOptionRegionX > 0 &&
(Event.getPageX(p_oEvent) > this._nOptionRegionX)) {
bReturnVal = false;
}
else {
this._hideMenu();
oSrcElement = this.get("srcelement");
if (oSrcElement && oSrcElement.type == "submit" &&
p_oEvent.returnValue !== false) {
this.submitForm();
}
}
sTitle = this._menu.cfg.getProperty("visible") ?
this.SPLITBUTTON_OPTION_VISIBLE_TITLE :
this.SPLITBUTTON_DEFAULT_TITLE;
this.set("title", sTitle);
break;
}
return bReturnVal;
},
@ -2505,7 +2450,9 @@ version: 2.6.0
var oButtonElement = this.get("element"),
oButtonParent = oButtonElement.parentNode,
oMenuElement = this._menu.element;
oMenu = this._menu,
oMenuElement = oMenu.element,
oSrcElement = oMenu.srcElement;
if (oButtonParent != oMenuElement.parentNode) {
@ -2516,55 +2463,21 @@ version: 2.6.0
this._renderedMenu = true;
this.set("selectedMenuItem", this.get("selectedMenuItem"));
// If the user has designated an <option> of the Menu's source
// <select> element to be selected, sync the selectedIndex with
// the "selectedMenuItem" Attribute.
if (oSrcElement &&
oSrcElement.nodeName.toLowerCase() === "select" &&
oSrcElement.value) {
this.set("selectedMenuItem",
oMenu.getItem(oSrcElement.selectedIndex));
}
},
/**
* @method _onMenuItemSelected
* @description "selectedchange" event handler for each item in the
* button's menu.
* @private
* @param {String} p_sType String representing the name of the event
* that was fired.
* @param {Array} p_aArgs Array of arguments sent when the event
* was fired.
* @param {MenuItem} p_oItem Object representing the menu item that
* subscribed to the event.
*/
_onMenuItemSelected: function (p_sType, p_aArgs, p_oItem) {
var bSelected = p_aArgs[0];
if (bSelected) {
this.set("selectedMenuItem", p_oItem);
}
},
/**
* @method _onMenuItemAdded
* @description "itemadded" event handler for the button's menu.
* @private
* @param {String} p_sType String representing the name of the event
* that was fired.
* @param {Array} p_aArgs Array of arguments sent when the event
* was fired.
* @param {<a href="YAHOO.widget.MenuItem.html">
* YAHOO.widget.MenuItem</a>} p_oItem Object representing the menu
* item that subscribed to the event.
*/
_onMenuItemAdded: function (p_sType, p_aArgs, p_oItem) {
var oItem = p_aArgs[0];
oItem.cfg.subscribeToConfigEvent("selected", this._onMenuItemSelected, oItem, this);
},
/**
@ -2598,7 +2511,29 @@ version: 2.6.0
}
},
/**
* @method _onSelectedMenuItemChange
* @description "selectedMenuItemChange" event handler for the Button's
* "selectedMenuItem" attribute.
* @param {Event} event Object representing the DOM event object
* passed back by the event utility (YAHOO.util.Event).
*/
_onSelectedMenuItemChange: function (event) {
var oSelected = event.prevValue,
oItem = event.newValue;
if (oSelected) {
Dom.removeClass(oSelected.element, "yui-button-selectedmenuitem");
}
if (oItem) {
Dom.addClass(oItem.element, "yui-button-selectedmenuitem");
}
},
// Public methods
@ -3025,6 +2960,16 @@ version: 2.6.0
this.on("mousedown", this._onMouseDown);
this.on("mouseup", this._onMouseUp);
this.on("click", this._onClick);
// Need to reset the value of the "onclick" Attribute so that any
// handlers registered via the "onclick" Attribute are fired after
// Button's default "_onClick" listener.
var fnOnClick = this.get("onclick");
this.set("onclick", null);
this.set("onclick", fnOnClick);
this.on("dblclick", this._onDblClick);
if (oLabel) {
@ -3133,6 +3078,7 @@ version: 2.6.0
* "radio," "menu," and "split."
* @default "push"
* @type String
* @writeonce
*/
this.setAttributeConfig("type", {
@ -3140,7 +3086,7 @@ version: 2.6.0
validator: Lang.isString,
writeOnce: true,
method: this._setType
});
@ -3288,6 +3234,7 @@ version: 2.6.0
* @type <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/
* level-one-html.html#ID-58190037">HTMLElement</a>|String
* @default null
* @writeonce
*/
this.setAttributeConfig("container", {
@ -3305,6 +3252,7 @@ version: 2.6.0
* @type <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/
* level-one-html.html#ID-58190037">HTMLElement</a>|String
* @default null
* @writeonce
*/
this.setAttributeConfig("srcelement", {
@ -3348,6 +3296,7 @@ version: 2.6.0
* href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-
* one-html.html#ID-58190037">HTMLElement</a>|String|Array
* @default null
* @writeonce
*/
this.setAttributeConfig("menu", {
@ -3381,6 +3330,7 @@ version: 2.6.0
* attribute.</em>
* @default true
* @type Boolean
* @writeonce
*/
this.setAttributeConfig("lazyloadmenu", {
@ -3397,6 +3347,7 @@ version: 2.6.0
* applied to the root element of the button's menu.
* @type String
* @default "yui-button-menu"
* @writeonce
*/
this.setAttributeConfig("menuclassname", {
@ -3467,8 +3418,7 @@ version: 2.6.0
*/
this.setAttributeConfig("selectedMenuItem", {
value: null,
method: this._setSelectedMenuItem
value: null
});
@ -4414,6 +4364,7 @@ version: 2.6.0
* @type <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/
* level-one-html.html#ID-58190037">HTMLElement</a>|String
* @default null
* @writeonce
*/
this.setAttributeConfig("container", {
@ -4795,4 +4746,4 @@ version: 2.6.0
});
})();
YAHOO.register("button", YAHOO.widget.Button, {version: "2.6.0", build: "1321"});
YAHOO.register("button", YAHOO.widget.Button, {version: "2.7.0", build: "1799"});