import v1.1.0_beta1 | 2009-08-21
This commit is contained in:
@ -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
|
||||
*/
|
||||
/* Menu & MenuBar styles */
|
||||
|
||||
@ -235,4 +235,8 @@ when one of its submenus is visible.
|
||||
|
||||
overflow: auto;
|
||||
|
||||
}
|
||||
|
||||
.yui-overlay.yui-force-redraw {
|
||||
margin-bottom: 1px;
|
||||
}
|
@ -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
|
||||
*/
|
||||
/* Menu & MenuBar styles */
|
||||
|
||||
|
@ -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
|
||||
*/
|
||||
/* MenuBar style rules */
|
||||
|
||||
@ -285,7 +285,7 @@ version: 2.6.0
|
||||
*/
|
||||
|
||||
opacity: .12;
|
||||
*filter: alpha(opacity=12); /* For IE */
|
||||
filter: alpha(opacity=12); /* For IE */
|
||||
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
*/
|
||||
.yuimenu{top:-999em;left:-999em;}.yuimenubar{position:static;}.yuimenu .yuimenu,.yuimenubar .yuimenu{position:absolute;}.yuimenubar li,.yuimenu li{list-style-type:none;}.yuimenubar ul,.yuimenu ul,.yuimenubar li,.yuimenu li,.yuimenu h6,.yuimenubar h6{margin:0;padding:0;}.yuimenuitemlabel,.yuimenubaritemlabel{text-align:left;white-space:nowrap;}.yuimenubar ul{*zoom:1;}.yuimenubar .yuimenu ul{*zoom:normal;}.yuimenubar>.bd>ul:after{content:".";display:block;clear:both;visibility:hidden;height:0;line-height:0;}.yuimenubaritem{float:left;}.yuimenubaritemlabel,.yuimenuitemlabel{display:block;}.yuimenuitemlabel .helptext{font-style:normal;display:block;margin:-1em 0 0 10em;}.yui-menu-shadow{position:absolute;visibility:hidden;z-index:-1;}.yui-menu-shadow-visible{top:2px;right:-3px;left:-3px;bottom:-3px;visibility:visible;}.hide-scrollbars *{overflow:hidden;}.hide-scrollbars select{display:none;}.yuimenu.show-scrollbars,.yuimenubar.show-scrollbars{overflow:visible;}.yuimenu.hide-scrollbars .yui-menu-shadow,.yuimenubar.hide-scrollbars .yui-menu-shadow{overflow:hidden;}.yuimenu.show-scrollbars .yui-menu-shadow,.yuimenubar.show-scrollbars .yui-menu-shadow{overflow:auto;}.yui-skin-sam .yuimenubar{font-size:93%;line-height:2;*line-height:1.9;border:solid 1px #808080;background:url(../../../../assets/skins/sam/sprite.png) repeat-x 0 0;}.yui-skin-sam .yuimenubarnav .yuimenubaritem{border-right:solid 1px #ccc;}.yui-skin-sam .yuimenubaritemlabel{padding:0 10px;color:#000;text-decoration:none;cursor:default;border-style:solid;border-color:#808080;border-width:1px 0;*position:relative;margin:-1px 0;}.yui-skin-sam .yuimenubarnav .yuimenubaritemlabel{padding-right:20px;*display:inline-block;}.yui-skin-sam .yuimenubarnav .yuimenubaritemlabel-hassubmenu{background:url(menubaritem_submenuindicator.png) right center no-repeat;}.yui-skin-sam .yuimenubaritem-selected{background:url(../../../../assets/skins/sam/sprite.png) repeat-x 0 -1700px;}.yui-skin-sam .yuimenubaritemlabel-selected{border-color:#7D98B8;}.yui-skin-sam .yuimenubarnav .yuimenubaritemlabel-selected{border-left-width:1px;margin-left:-1px;*left:-1px;}.yui-skin-sam .yuimenubaritemlabel-disabled{cursor:default;color:#A6A6A6;}.yui-skin-sam .yuimenubarnav .yuimenubaritemlabel-hassubmenu-disabled{background-image:url(menubaritem_submenuindicator_disabled.png);}.yui-skin-sam .yuimenu{font-size:93%;line-height:1.5;*line-height:1.45;}.yui-skin-sam .yuimenubar .yuimenu,.yui-skin-sam .yuimenu .yuimenu{font-size:100%;}.yui-skin-sam .yuimenu .bd{*zoom:1;_zoom:normal;border:solid 1px #808080;background-color:#fff;}.yui-skin-sam .yuimenu .yuimenu .bd{*zoom:normal;}.yui-skin-sam .yuimenu ul{padding:3px 0;border-width:1px 0 0 0;border-color:#ccc;border-style:solid;}.yui-skin-sam .yuimenu ul.first-of-type{border-width:0;}.yui-skin-sam .yuimenu h6{font-weight:bold;border-style:solid;border-color:#ccc;border-width:1px 0 0 0;color:#a4a4a4;padding:3px 10px 0 10px;}.yui-skin-sam .yuimenu ul.hastitle,.yui-skin-sam .yuimenu h6.first-of-type{border-width:0;}.yui-skin-sam .yuimenu .yui-menu-body-scrolled{border-color:#ccc #808080;overflow:hidden;}.yui-skin-sam .yuimenu .topscrollbar,.yui-skin-sam .yuimenu .bottomscrollbar{height:16px;border:solid 1px #808080;background:#fff url(../../../../assets/skins/sam/sprite.png) no-repeat 0 0;}.yui-skin-sam .yuimenu .topscrollbar{border-bottom-width:0;background-position:center -950px;}.yui-skin-sam .yuimenu .topscrollbar_disabled{background-position:center -975px;}.yui-skin-sam .yuimenu .bottomscrollbar{border-top-width:0;background-position:center -850px;}.yui-skin-sam .yuimenu .bottomscrollbar_disabled{background-position:center -875px;}.yui-skin-sam .yuimenuitem{_border-bottom:solid 1px #fff;}.yui-skin-sam .yuimenuitemlabel{padding:0 20px;color:#000;text-decoration:none;cursor:default;}.yui-skin-sam .yuimenuitemlabel .helptext{margin-top:-1.5em;*margin-top:-1.45em;}.yui-skin-sam .yuimenuitem-hassubmenu{background-image:url(menuitem_submenuindicator.png);background-position:right center;background-repeat:no-repeat;}.yui-skin-sam .yuimenuitem-checked{background-image:url(menuitem_checkbox.png);background-position:left center;background-repeat:no-repeat;}.yui-skin-sam .yui-menu-shadow-visible{background-color:#000;opacity:.12;*filter:alpha(opacity=12);}.yui-skin-sam .yuimenuitem-selected{background-color:#B3D4FF;}.yui-skin-sam .yuimenuitemlabel-disabled{cursor:default;color:#A6A6A6;}.yui-skin-sam .yuimenuitem-hassubmenu-disabled{background-image:url(menuitem_submenuindicator_disabled.png);}.yui-skin-sam .yuimenuitem-checked-disabled{background-image:url(menuitem_checkbox_disabled.png);}
|
||||
.yuimenu{top:-999em;left:-999em;}.yuimenubar{position:static;}.yuimenu .yuimenu,.yuimenubar .yuimenu{position:absolute;}.yuimenubar li,.yuimenu li{list-style-type:none;}.yuimenubar ul,.yuimenu ul,.yuimenubar li,.yuimenu li,.yuimenu h6,.yuimenubar h6{margin:0;padding:0;}.yuimenuitemlabel,.yuimenubaritemlabel{text-align:left;white-space:nowrap;}.yuimenubar ul{*zoom:1;}.yuimenubar .yuimenu ul{*zoom:normal;}.yuimenubar>.bd>ul:after{content:".";display:block;clear:both;visibility:hidden;height:0;line-height:0;}.yuimenubaritem{float:left;}.yuimenubaritemlabel,.yuimenuitemlabel{display:block;}.yuimenuitemlabel .helptext{font-style:normal;display:block;margin:-1em 0 0 10em;}.yui-menu-shadow{position:absolute;visibility:hidden;z-index:-1;}.yui-menu-shadow-visible{top:2px;right:-3px;left:-3px;bottom:-3px;visibility:visible;}.hide-scrollbars *{overflow:hidden;}.hide-scrollbars select{display:none;}.yuimenu.show-scrollbars,.yuimenubar.show-scrollbars{overflow:visible;}.yuimenu.hide-scrollbars .yui-menu-shadow,.yuimenubar.hide-scrollbars .yui-menu-shadow{overflow:hidden;}.yuimenu.show-scrollbars .yui-menu-shadow,.yuimenubar.show-scrollbars .yui-menu-shadow{overflow:auto;}.yui-overlay.yui-force-redraw{margin-bottom:1px;}.yui-skin-sam .yuimenubar{font-size:93%;line-height:2;*line-height:1.9;border:solid 1px #808080;background:url(../../../../assets/skins/sam/sprite.png) repeat-x 0 0;}.yui-skin-sam .yuimenubarnav .yuimenubaritem{border-right:solid 1px #ccc;}.yui-skin-sam .yuimenubaritemlabel{padding:0 10px;color:#000;text-decoration:none;cursor:default;border-style:solid;border-color:#808080;border-width:1px 0;*position:relative;margin:-1px 0;}.yui-skin-sam .yuimenubarnav .yuimenubaritemlabel{padding-right:20px;*display:inline-block;}.yui-skin-sam .yuimenubarnav .yuimenubaritemlabel-hassubmenu{background:url(menubaritem_submenuindicator.png) right center no-repeat;}.yui-skin-sam .yuimenubaritem-selected{background:url(../../../../assets/skins/sam/sprite.png) repeat-x 0 -1700px;}.yui-skin-sam .yuimenubaritemlabel-selected{border-color:#7D98B8;}.yui-skin-sam .yuimenubarnav .yuimenubaritemlabel-selected{border-left-width:1px;margin-left:-1px;*left:-1px;}.yui-skin-sam .yuimenubaritemlabel-disabled{cursor:default;color:#A6A6A6;}.yui-skin-sam .yuimenubarnav .yuimenubaritemlabel-hassubmenu-disabled{background-image:url(menubaritem_submenuindicator_disabled.png);}.yui-skin-sam .yuimenu{font-size:93%;line-height:1.5;*line-height:1.45;}.yui-skin-sam .yuimenubar .yuimenu,.yui-skin-sam .yuimenu .yuimenu{font-size:100%;}.yui-skin-sam .yuimenu .bd{*zoom:1;_zoom:normal;border:solid 1px #808080;background-color:#fff;}.yui-skin-sam .yuimenu .yuimenu .bd{*zoom:normal;}.yui-skin-sam .yuimenu ul{padding:3px 0;border-width:1px 0 0 0;border-color:#ccc;border-style:solid;}.yui-skin-sam .yuimenu ul.first-of-type{border-width:0;}.yui-skin-sam .yuimenu h6{font-weight:bold;border-style:solid;border-color:#ccc;border-width:1px 0 0 0;color:#a4a4a4;padding:3px 10px 0 10px;}.yui-skin-sam .yuimenu ul.hastitle,.yui-skin-sam .yuimenu h6.first-of-type{border-width:0;}.yui-skin-sam .yuimenu .yui-menu-body-scrolled{border-color:#ccc #808080;overflow:hidden;}.yui-skin-sam .yuimenu .topscrollbar,.yui-skin-sam .yuimenu .bottomscrollbar{height:16px;border:solid 1px #808080;background:#fff url(../../../../assets/skins/sam/sprite.png) no-repeat 0 0;}.yui-skin-sam .yuimenu .topscrollbar{border-bottom-width:0;background-position:center -950px;}.yui-skin-sam .yuimenu .topscrollbar_disabled{background-position:center -975px;}.yui-skin-sam .yuimenu .bottomscrollbar{border-top-width:0;background-position:center -850px;}.yui-skin-sam .yuimenu .bottomscrollbar_disabled{background-position:center -875px;}.yui-skin-sam .yuimenuitem{_border-bottom:solid 1px #fff;}.yui-skin-sam .yuimenuitemlabel{padding:0 20px;color:#000;text-decoration:none;cursor:default;}.yui-skin-sam .yuimenuitemlabel .helptext{margin-top:-1.5em;*margin-top:-1.45em;}.yui-skin-sam .yuimenuitem-hassubmenu{background-image:url(menuitem_submenuindicator.png);background-position:right center;background-repeat:no-repeat;}.yui-skin-sam .yuimenuitem-checked{background-image:url(menuitem_checkbox.png);background-position:left center;background-repeat:no-repeat;}.yui-skin-sam .yui-menu-shadow-visible{background-color:#000;opacity:.12;filter:alpha(opacity=12);}.yui-skin-sam .yuimenuitem-selected{background-color:#B3D4FF;}.yui-skin-sam .yuimenuitemlabel-disabled{cursor:default;color:#A6A6A6;}.yui-skin-sam .yuimenuitem-hassubmenu-disabled{background-image:url(menuitem_submenuindicator_disabled.png);}.yui-skin-sam .yuimenuitem-checked-disabled{background-image:url(menuitem_checkbox_disabled.png);}
|
||||
|
459
webdir/javascript/yui/menu/menu-debug.js
vendored
459
webdir/javascript/yui/menu/menu-debug.js
vendored
@ -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
|
||||
*/
|
||||
|
||||
|
||||
@ -1271,7 +1271,7 @@ OFF_SCREEN_POSITION: "-999em",
|
||||
|
||||
|
||||
/**
|
||||
* @property _bHideDelayEventHandlersAssigned
|
||||
* @property _useHideDelay
|
||||
* @description Boolean indicating if the "mouseover" and "mouseout" event
|
||||
* handlers used for hiding the menu via a call to "YAHOO.lang.later" have
|
||||
* already been assigned.
|
||||
@ -1279,7 +1279,7 @@ OFF_SCREEN_POSITION: "-999em",
|
||||
* @private
|
||||
* @type Boolean
|
||||
*/
|
||||
_bHideDelayEventHandlersAssigned: false,
|
||||
_useHideDelay: false,
|
||||
|
||||
|
||||
/**
|
||||
@ -1653,9 +1653,12 @@ init: function (p_oElement, p_oConfig) {
|
||||
this.keyDownEvent.subscribe(this._onKeyDown);
|
||||
this.keyPressEvent.subscribe(this._onKeyPress);
|
||||
this.blurEvent.subscribe(this._onBlur);
|
||||
|
||||
|
||||
if (UA.gecko || UA.webkit) {
|
||||
|
||||
// Fixes an issue in Firefox 2 and Webkit where Dom's "getX" and "getY"
|
||||
// methods return values that don't take scrollTop into consideration
|
||||
|
||||
if ((UA.gecko && UA.gecko < 1.9) || UA.webkit) {
|
||||
|
||||
this.cfg.subscribeToConfigEvent(_Y, this._onYChange);
|
||||
|
||||
@ -2637,6 +2640,10 @@ _onMouseOver: function (p_sType, p_aArgs) {
|
||||
Dom.isAncestor(this.element, oTarget))) {
|
||||
|
||||
// Menu mouseover logic
|
||||
|
||||
if (this._useHideDelay) {
|
||||
this._cancelHideDelay();
|
||||
}
|
||||
|
||||
this._nCurrentMouseX = 0;
|
||||
|
||||
@ -2832,7 +2839,11 @@ _onMouseOut: function (p_sType, p_aArgs) {
|
||||
!Dom.isAncestor(this.element, oRelatedTarget)) || bMovingToSubmenu)) {
|
||||
|
||||
// Menu mouseout logic
|
||||
|
||||
|
||||
if (this._useHideDelay) {
|
||||
this._execHideDelay();
|
||||
}
|
||||
|
||||
Event.removeListener(this.element, _MOUSEMOVE, this._onMouseMove);
|
||||
|
||||
this._nCurrentMouseX = Event.getPageX(oEvent);
|
||||
@ -2881,6 +2892,7 @@ _onClick: function (p_sType, p_aArgs) {
|
||||
oItem = p_aArgs[1],
|
||||
bInMenuAnchor = false,
|
||||
oSubmenu,
|
||||
oMenu,
|
||||
oRoot,
|
||||
sId,
|
||||
sURL,
|
||||
@ -2891,16 +2903,16 @@ _onClick: function (p_sType, p_aArgs) {
|
||||
var hide = function () {
|
||||
|
||||
/*
|
||||
There is an inconsistency between Firefox 2 for Mac OS X and Firefox 2 Windows
|
||||
There is an inconsistency between Firefox for Mac OS X and Firefox Windows
|
||||
regarding the triggering of the display of the browser's context menu and the
|
||||
subsequent firing of the "click" event. In Firefox for Windows, when the user
|
||||
triggers the display of the browser's context menu the "click" event also fires
|
||||
for the document object, even though the "click" event did not fire for the
|
||||
element that was the original target of the "contextmenu" event. This is unique
|
||||
to Firefox on Windows. For all other A-Grade browsers, including Firefox 2 for
|
||||
to Firefox on Windows. For all other A-Grade browsers, including Firefox for
|
||||
Mac OS X, the "click" event doesn't fire for the document object.
|
||||
|
||||
This bug in Firefox 2 for Windows affects Menu as Menu instances listen for
|
||||
This bug in Firefox for Windows affects Menu as Menu instances listen for
|
||||
events at the document level and have an internal "click" event handler they
|
||||
use to hide themselves when clicked. As a result, in Firefox for Windows a
|
||||
Menu will hide when the user right clicks on a MenuItem to raise the browser's
|
||||
@ -2969,7 +2981,14 @@ _onClick: function (p_sType, p_aArgs) {
|
||||
|
||||
sId = sURL.substr(1, nLen);
|
||||
|
||||
bInMenuAnchor = Dom.isAncestor(this.element, sId);
|
||||
oMenu = YAHOO.widget.MenuManager.getMenu(sId);
|
||||
|
||||
if (oMenu) {
|
||||
|
||||
bInMenuAnchor =
|
||||
(this.getRoot() === oMenu.getRoot());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else if (nLen === 1) {
|
||||
@ -2982,7 +3001,6 @@ _onClick: function (p_sType, p_aArgs) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (bInMenuAnchor && !oItem.cfg.getProperty(_TARGET)) {
|
||||
|
||||
@ -3043,6 +3061,11 @@ _onKeyDown: function (p_sType, p_aArgs) {
|
||||
oParentMenu;
|
||||
|
||||
|
||||
if (this._useHideDelay) {
|
||||
this._cancelHideDelay();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
This function is called to prevent a bug in Firefox. In Firefox,
|
||||
moving a DOM element into a stationary mouse pointer will cause the
|
||||
@ -3858,8 +3881,8 @@ getConstrainedY: function (y) {
|
||||
nTopRegionHeight,
|
||||
nBottomRegionHeight,
|
||||
|
||||
topConstraint,
|
||||
bottomConstraint,
|
||||
topConstraint = scrollY + nViewportOffset,
|
||||
bottomConstraint = scrollY + viewPortHeight - nMenuOffsetHeight - nViewportOffset,
|
||||
|
||||
yNew = y;
|
||||
|
||||
@ -3943,8 +3966,7 @@ getConstrainedY: function (y) {
|
||||
var nDisplayRegionHeight = getDisplayRegionHeight(),
|
||||
bMenuHasItems = (oMenu.getItems().length > 0),
|
||||
nMenuMinScrollHeight,
|
||||
fnReturnVal,
|
||||
nNewY;
|
||||
fnReturnVal;
|
||||
|
||||
|
||||
if (nMenuOffsetHeight > nDisplayRegionHeight) {
|
||||
@ -3997,7 +4019,7 @@ getConstrainedY: function (y) {
|
||||
}
|
||||
|
||||
}
|
||||
else if (nMaxHeight && (nMaxHeight != nInitialMaxHeight)) {
|
||||
else if (nMaxHeight && (nMaxHeight !== nInitialMaxHeight)) {
|
||||
|
||||
oMenu._setScrollHeight(nInitialMaxHeight);
|
||||
oMenu.hideEvent.subscribe(resetMaxHeight);
|
||||
@ -4014,55 +4036,76 @@ getConstrainedY: function (y) {
|
||||
};
|
||||
|
||||
|
||||
if (oMenu.cfg.getProperty(_PREVENT_CONTEXT_OVERLAP) && bPotentialContextOverlap) {
|
||||
// Determine if the current value for the Menu's "y" configuration property will
|
||||
// result in the Menu being positioned outside the boundaries of the viewport
|
||||
|
||||
if (y < topConstraint || y > bottomConstraint) {
|
||||
|
||||
// The current value for the Menu's "y" configuration property WILL
|
||||
// result in the Menu being positioned outside the boundaries of the viewport
|
||||
|
||||
if (bCanConstrain) {
|
||||
|
||||
oContextEl = aContext[0];
|
||||
nContextElHeight = oContextEl.offsetHeight;
|
||||
nContextElY = (Dom.getY(oContextEl) - scrollY);
|
||||
|
||||
nTopRegionHeight = nContextElY;
|
||||
nBottomRegionHeight = (viewPortHeight - (nContextElY + nContextElHeight));
|
||||
|
||||
setVerticalPosition();
|
||||
if (oMenu.cfg.getProperty(_PREVENT_CONTEXT_OVERLAP) && bPotentialContextOverlap) {
|
||||
|
||||
}
|
||||
// SOLUTION #1:
|
||||
// If the "preventcontextoverlap" configuration property is set to "true",
|
||||
// try to flip and/or scroll the Menu to both keep it inside the boundaries of the
|
||||
// viewport AND from overlaping its context element (MenuItem or MenuBarItem).
|
||||
|
||||
yNew = oMenu.cfg.getProperty(_Y);
|
||||
|
||||
}
|
||||
else if (!(oMenu instanceof YAHOO.widget.MenuBar) && nMenuOffsetHeight >= viewPortHeight) {
|
||||
oContextEl = aContext[0];
|
||||
nContextElHeight = oContextEl.offsetHeight;
|
||||
nContextElY = (Dom.getY(oContextEl) - scrollY);
|
||||
|
||||
nAvailableHeight = (viewPortHeight - (nViewportOffset * 2));
|
||||
|
||||
if (nAvailableHeight > oMenu.cfg.getProperty(_MIN_SCROLL_HEIGHT)) {
|
||||
|
||||
oMenu._setScrollHeight(nAvailableHeight);
|
||||
oMenu.hideEvent.subscribe(resetMaxHeight);
|
||||
|
||||
alignY();
|
||||
|
||||
yNew = oMenu.cfg.getProperty(_Y);
|
||||
nTopRegionHeight = nContextElY;
|
||||
nBottomRegionHeight = (viewPortHeight - (nContextElY + nContextElHeight));
|
||||
|
||||
setVerticalPosition();
|
||||
|
||||
yNew = oMenu.cfg.getProperty(_Y);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
if (bCanConstrain) {
|
||||
|
||||
topConstraint = scrollY + nViewportOffset;
|
||||
bottomConstraint = scrollY + viewPortHeight - nMenuOffsetHeight - nViewportOffset;
|
||||
|
||||
if (y < topConstraint) {
|
||||
yNew = topConstraint;
|
||||
} else if (y > bottomConstraint) {
|
||||
yNew = bottomConstraint;
|
||||
}
|
||||
} else {
|
||||
yNew = nViewportOffset + scrollY;
|
||||
else if (!(oMenu instanceof YAHOO.widget.MenuBar) &&
|
||||
nMenuOffsetHeight >= viewPortHeight) {
|
||||
|
||||
// SOLUTION #2:
|
||||
// If the Menu exceeds the height of the viewport, introduce scroll bars
|
||||
// to keep the Menu inside the boundaries of the viewport
|
||||
|
||||
nAvailableHeight = (viewPortHeight - (nViewportOffset * 2));
|
||||
|
||||
if (nAvailableHeight > oMenu.cfg.getProperty(_MIN_SCROLL_HEIGHT)) {
|
||||
|
||||
oMenu._setScrollHeight(nAvailableHeight);
|
||||
oMenu.hideEvent.subscribe(resetMaxHeight);
|
||||
|
||||
alignY();
|
||||
|
||||
yNew = oMenu.cfg.getProperty(_Y);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
// SOLUTION #3:
|
||||
|
||||
if (y < topConstraint) {
|
||||
yNew = topConstraint;
|
||||
} else if (y > bottomConstraint) {
|
||||
yNew = bottomConstraint;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
// The "y" configuration property cannot be set to a value that will keep
|
||||
// entire Menu inside the boundary of the viewport. Therefore, set
|
||||
// the "y" configuration property to scrollY to keep as much of the
|
||||
// Menu inside the viewport as possible.
|
||||
yNew = nViewportOffset + scrollY;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -4159,13 +4202,13 @@ _onShow: function (p_sType, p_aArgs) {
|
||||
}
|
||||
|
||||
|
||||
// The following fixes an issue with the selected state of a MenuItem not rendering
|
||||
// correctly when a submenu is aligned to the left of its parent Menu instance.
|
||||
// The following fixes an issue with the selected state of a MenuItem
|
||||
// not rendering correctly when a submenu is aligned to the left of
|
||||
// its parent Menu instance.
|
||||
|
||||
if ((this.cfg.getProperty("x") < oParentMenu.cfg.getProperty("x")) &&
|
||||
(UA.gecko < 1.9) &&
|
||||
!this.cfg.getProperty(_WIDTH)) {
|
||||
|
||||
(UA.gecko && UA.gecko < 1.9) && !this.cfg.getProperty(_WIDTH)) {
|
||||
|
||||
oElement = this.element;
|
||||
nOffsetWidth = oElement.offsetWidth;
|
||||
|
||||
@ -4273,6 +4316,7 @@ _onParentMenuConfigChange: function (p_sType, p_aArgs, p_oSubmenu) {
|
||||
case _EFFECT:
|
||||
case _CLASSNAME:
|
||||
case _SCROLL_INCREMENT:
|
||||
case _MAX_HEIGHT:
|
||||
case _MIN_SCROLL_HEIGHT:
|
||||
case _MONITOR_RESIZE:
|
||||
case _SHADOW:
|
||||
@ -4333,6 +4377,8 @@ _onParentMenuRender: function (p_sType, p_aArgs, p_oSubmenu) {
|
||||
|
||||
scrollincrement: oParentCfg.getProperty(_SCROLL_INCREMENT),
|
||||
|
||||
maxheight: oParentCfg.getProperty(_MAX_HEIGHT),
|
||||
|
||||
minscrollheight: oParentCfg.getProperty(_MIN_SCROLL_HEIGHT),
|
||||
|
||||
iframe: oParentCfg.getProperty(_IFRAME),
|
||||
@ -4590,38 +4636,9 @@ configIframe: function (p_sType, p_aArgs, p_oMenu) {
|
||||
*/
|
||||
configHideDelay: function (p_sType, p_aArgs, p_oMenu) {
|
||||
|
||||
var nHideDelay = p_aArgs[0],
|
||||
oMouseOutEvent = this.mouseOutEvent,
|
||||
oMouseOverEvent = this.mouseOverEvent,
|
||||
oKeyDownEvent = this.keyDownEvent;
|
||||
var nHideDelay = p_aArgs[0];
|
||||
|
||||
if (nHideDelay > 0) {
|
||||
|
||||
/*
|
||||
Only assign event handlers once. This way the user change
|
||||
the value for the hidedelay as many times as they want.
|
||||
*/
|
||||
|
||||
if (!this._bHideDelayEventHandlersAssigned) {
|
||||
|
||||
oMouseOutEvent.subscribe(this._execHideDelay);
|
||||
oMouseOverEvent.subscribe(this._cancelHideDelay);
|
||||
oKeyDownEvent.subscribe(this._cancelHideDelay);
|
||||
|
||||
this._bHideDelayEventHandlersAssigned = true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
oMouseOutEvent.unsubscribe(this._execHideDelay);
|
||||
oMouseOverEvent.unsubscribe(this._cancelHideDelay);
|
||||
oKeyDownEvent.unsubscribe(this._cancelHideDelay);
|
||||
|
||||
this._bHideDelayEventHandlersAssigned = false;
|
||||
|
||||
}
|
||||
this._useHideDelay = (nHideDelay > 0);
|
||||
|
||||
},
|
||||
|
||||
@ -4683,7 +4700,6 @@ _setScrollHeight: function (p_nScrollHeight) {
|
||||
oBody,
|
||||
oHeader,
|
||||
oFooter,
|
||||
oParent,
|
||||
fnMouseOver,
|
||||
fnMouseOut,
|
||||
nMinScrollHeight,
|
||||
@ -4701,7 +4717,6 @@ _setScrollHeight: function (p_nScrollHeight) {
|
||||
fnMouseOver = this._onScrollTargetMouseOver;
|
||||
fnMouseOut = this._onScrollTargetMouseOut;
|
||||
nMinScrollHeight = this.cfg.getProperty(_MIN_SCROLL_HEIGHT);
|
||||
oParent = this.parent;
|
||||
|
||||
|
||||
if (nScrollHeight > 0 && nScrollHeight < nMinScrollHeight) {
|
||||
@ -4716,24 +4731,26 @@ _setScrollHeight: function (p_nScrollHeight) {
|
||||
oBody.scrollTop = 0;
|
||||
|
||||
|
||||
/*
|
||||
There is a bug in gecko-based browsers where an element whose
|
||||
"position" property is set to "absolute" and "overflow" property is set
|
||||
to "hidden" will not render at the correct width when its
|
||||
offsetParent's "position" property is also set to "absolute." It is
|
||||
possible to work around this bug by specifying a value for the width
|
||||
property in addition to overflow.
|
||||
// Need to set a width for the Menu to fix the following problems in
|
||||
// Firefox 2 and IE:
|
||||
|
||||
// #1) Scrolled Menus will render at 1px wide in Firefox 2
|
||||
|
||||
// #2) There is a bug in gecko-based browsers where an element whose
|
||||
// "position" property is set to "absolute" and "overflow" property is
|
||||
// set to "hidden" will not render at the correct width when its
|
||||
// offsetParent's "position" property is also set to "absolute." It is
|
||||
// possible to work around this bug by specifying a value for the width
|
||||
// property in addition to overflow.
|
||||
|
||||
// #3) In IE it is necessary to give the Menu a width before the
|
||||
// scrollbars are rendered to prevent the Menu from rendering with a
|
||||
// width that is 100% of the browser viewport.
|
||||
|
||||
In IE it is also necessary to give the Menu a width before the scrollbars are
|
||||
rendered to prevent the Menu from rendering with a width that is 100% of
|
||||
the browser viewport.
|
||||
*/
|
||||
|
||||
bSetWidth = ((UA.gecko && oParent && oParent.parent &&
|
||||
oParent.parent.cfg.getProperty(_POSITION) == _DYNAMIC) || UA.ie);
|
||||
bSetWidth = ((UA.gecko && UA.gecko < 1.9) || UA.ie);
|
||||
|
||||
if (nScrollHeight > 0 && bSetWidth && !this.cfg.getProperty(_WIDTH)) {
|
||||
|
||||
|
||||
nOffsetWidth = oElement.offsetWidth;
|
||||
|
||||
/*
|
||||
@ -5153,7 +5170,7 @@ configShadow: function (p_sType, p_aArgs, p_oMenu) {
|
||||
|
||||
|
||||
var onBeforeShow = function () {
|
||||
|
||||
|
||||
if (this._shadow) {
|
||||
|
||||
// If called because the "shadow" event was refired - just append again and resize
|
||||
@ -6427,7 +6444,7 @@ initDefaultConfig: function () {
|
||||
/**
|
||||
* @config keepopen
|
||||
* @description Boolean indicating if the menu should remain open when clicked.
|
||||
* @default flase
|
||||
* @default false
|
||||
* @type Boolean
|
||||
*/
|
||||
oConfig.addProperty(
|
||||
@ -6519,9 +6536,7 @@ var Dom = YAHOO.util.Dom,
|
||||
_OPTION = "OPTION",
|
||||
_OPTGROUP = "OPTGROUP",
|
||||
_LI_UPPERCASE = "LI",
|
||||
_LI_LOWERCASE = "li",
|
||||
_HREF = "href",
|
||||
_ANCHOR_TEMPLATE = "<a href=\"#\"></a>",
|
||||
_SELECT = "SELECT",
|
||||
_DIV = "DIV",
|
||||
_START_HELP_TEXT = "<em class=\"helptext\">",
|
||||
@ -6536,6 +6551,11 @@ var Dom = YAHOO.util.Dom,
|
||||
_VISIBLE = "visible",
|
||||
_SPACE = " ",
|
||||
_MENUITEM = "MenuItem",
|
||||
_CLICK = "click",
|
||||
_SHOW = "show",
|
||||
_HIDE = "hide",
|
||||
_LI_LOWERCASE = "li",
|
||||
_ANCHOR_TEMPLATE = "<a href=\"#\"></a>",
|
||||
|
||||
EVENT_TYPES = [
|
||||
|
||||
@ -6543,7 +6563,7 @@ var Dom = YAHOO.util.Dom,
|
||||
["mouseOutEvent", "mouseout"],
|
||||
["mouseDownEvent", "mousedown"],
|
||||
["mouseUpEvent", "mouseup"],
|
||||
["clickEvent", "click"],
|
||||
["clickEvent", _CLICK],
|
||||
["keyPressEvent", "keypress"],
|
||||
["keyDownEvent", "keydown"],
|
||||
["keyUpEvent", "keyup"],
|
||||
@ -6634,9 +6654,15 @@ var Dom = YAHOO.util.Dom,
|
||||
suppressEvent: true
|
||||
},
|
||||
|
||||
CLASS_NAMES = {},
|
||||
|
||||
m_oMenuItemTemplate;
|
||||
KEY_LISTENER_CONFIG = {
|
||||
key: "keylistener",
|
||||
value: null,
|
||||
suppressEvent: true
|
||||
},
|
||||
|
||||
m_oMenuItemTemplate = null,
|
||||
|
||||
CLASS_NAMES = {};
|
||||
|
||||
|
||||
/**
|
||||
@ -7181,7 +7207,7 @@ MenuItem.prototype = {
|
||||
|
||||
oAnchor = oElement.firstChild;
|
||||
oAnchor.className = this.CSS_LABEL_CLASS_NAME;
|
||||
|
||||
|
||||
this.element = oElement;
|
||||
this._oAnchor = oAnchor;
|
||||
|
||||
@ -7865,6 +7891,150 @@ MenuItem.prototype = {
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* @method _dispatchClickEvent
|
||||
* @description Dispatches a DOM "click" event to the anchor element of a
|
||||
* MenuItem instance.
|
||||
* @private
|
||||
*/
|
||||
_dispatchClickEvent: function () {
|
||||
|
||||
var oMenuItem = this,
|
||||
oAnchor,
|
||||
oEvent;
|
||||
|
||||
if (!oMenuItem.cfg.getProperty(_DISABLED)) {
|
||||
|
||||
oAnchor = Dom.getFirstChild(oMenuItem.element);
|
||||
|
||||
// Dispatch a "click" event to the MenuItem's anchor so that its
|
||||
// "click" event handlers will get called in response to the user
|
||||
// pressing the keyboard shortcut defined by the "keylistener"
|
||||
// configuration property.
|
||||
|
||||
if (UA.ie) {
|
||||
oAnchor.fireEvent(_ONCLICK);
|
||||
}
|
||||
else {
|
||||
|
||||
if ((UA.gecko && UA.gecko >= 1.9) || UA.opera || UA.webkit) {
|
||||
|
||||
oEvent = document.createEvent("HTMLEvents");
|
||||
oEvent.initEvent(_CLICK, true, true);
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
oEvent = document.createEvent("MouseEvents");
|
||||
oEvent.initMouseEvent(_CLICK, true, true, window, 0, 0, 0,
|
||||
0, 0, false, false, false, false, 0, null);
|
||||
|
||||
}
|
||||
|
||||
oAnchor.dispatchEvent(oEvent);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* @method _createKeyListener
|
||||
* @description "show" event handler for a Menu instance - responsible for
|
||||
* setting up the KeyListener instance for a MenuItem.
|
||||
* @private
|
||||
* @param {String} type String representing the name of the event that
|
||||
* was fired.
|
||||
* @param {Array} args Array of arguments sent when the event was fired.
|
||||
* @param {Array} keyData Array of arguments sent when the event was fired.
|
||||
*/
|
||||
_createKeyListener: function (type, args, keyData) {
|
||||
|
||||
var oMenuItem = this,
|
||||
oMenu = oMenuItem.parent;
|
||||
|
||||
var oKeyListener = new YAHOO.util.KeyListener(
|
||||
oMenu.element.ownerDocument,
|
||||
keyData,
|
||||
{
|
||||
fn: oMenuItem._dispatchClickEvent,
|
||||
scope: oMenuItem,
|
||||
correctScope: true });
|
||||
|
||||
|
||||
if (oMenu.cfg.getProperty(_VISIBLE)) {
|
||||
oKeyListener.enable();
|
||||
}
|
||||
|
||||
|
||||
oMenu.subscribe(_SHOW, oKeyListener.enable, null, oKeyListener);
|
||||
oMenu.subscribe(_HIDE, oKeyListener.disable, null, oKeyListener);
|
||||
|
||||
oMenuItem._keyListener = oKeyListener;
|
||||
|
||||
oMenu.unsubscribe(_SHOW, oMenuItem._createKeyListener, keyData);
|
||||
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* @method configKeyListener
|
||||
* @description Event handler for when the "keylistener" configuration
|
||||
* property of a menu item changes.
|
||||
* @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.
|
||||
*/
|
||||
configKeyListener: function (p_sType, p_aArgs) {
|
||||
|
||||
var oKeyData = p_aArgs[0],
|
||||
oMenuItem = this,
|
||||
oMenu = oMenuItem.parent;
|
||||
|
||||
if (oMenuItem._keyData) {
|
||||
|
||||
// Unsubscribe from the "show" event in case the keylistener
|
||||
// config was changed before the Menu was ever made visible.
|
||||
|
||||
oMenu.unsubscribe(_SHOW,
|
||||
oMenuItem._createKeyListener, oMenuItem._keyData);
|
||||
|
||||
oMenuItem._keyData = null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Tear down for the previous value of the "keylistener" property
|
||||
|
||||
if (oMenuItem._keyListener) {
|
||||
|
||||
oMenu.unsubscribe(_SHOW, oMenuItem._keyListener.enable);
|
||||
oMenu.unsubscribe(_HIDE, oMenuItem._keyListener.disable);
|
||||
|
||||
oMenuItem._keyListener.disable();
|
||||
oMenuItem._keyListener = null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (oKeyData) {
|
||||
|
||||
oMenuItem._keyData = oKeyData;
|
||||
|
||||
// Defer the creation of the KeyListener instance until the
|
||||
// parent Menu is visible. This is necessary since the
|
||||
// KeyListener instance needs to be bound to the document the
|
||||
// Menu has been rendered into. Deferring creation of the
|
||||
// KeyListener instance also improves performance.
|
||||
|
||||
oMenu.subscribe(_SHOW, oMenuItem._createKeyListener,
|
||||
oKeyData, oMenuItem);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
|
||||
// Public methods
|
||||
|
||||
@ -8125,6 +8295,25 @@ MenuItem.prototype = {
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* @config keylistener
|
||||
* @description Object literal representing the key(s) that can be used
|
||||
* to trigger the MenuItem's "click" event. Possible attributes are
|
||||
* shift (boolean), alt (boolean), ctrl (boolean) and keys (either an int
|
||||
* or an array of ints representing keycodes).
|
||||
* @default null
|
||||
* @type Object
|
||||
*/
|
||||
oConfig.addProperty(
|
||||
KEY_LISTENER_CONFIG.key,
|
||||
{
|
||||
handler: this.configKeyListener,
|
||||
value: KEY_LISTENER_CONFIG.value,
|
||||
suppressEvent: KEY_LISTENER_CONFIG.suppressEvent
|
||||
}
|
||||
);
|
||||
|
||||
},
|
||||
|
||||
|
||||
@ -8744,29 +8933,29 @@ _onTriggerContextMenu: function(p_oEvent, p_oMenu) {
|
||||
var aXY;
|
||||
|
||||
if (!(p_oEvent.type == _MOUSEDOWN && !p_oEvent.ctrlKey)) {
|
||||
|
||||
/*
|
||||
Prevent the browser's default context menu from appearing and
|
||||
stop the propagation of the "contextmenu" event so that
|
||||
other ContextMenu instances are not displayed.
|
||||
*/
|
||||
|
||||
Event.stopEvent(p_oEvent);
|
||||
|
||||
|
||||
this.contextEventTarget = Event.getTarget(p_oEvent);
|
||||
|
||||
this.triggerContextMenuEvent.fire(p_oEvent);
|
||||
|
||||
|
||||
// Hide any other Menu instances that might be visible
|
||||
|
||||
YAHOO.widget.MenuManager.hideVisible();
|
||||
|
||||
|
||||
|
||||
if (!this._bCancelled) {
|
||||
|
||||
/*
|
||||
Prevent the browser's default context menu from appearing and
|
||||
stop the propagation of the "contextmenu" event so that
|
||||
other ContextMenu instances are not displayed.
|
||||
*/
|
||||
|
||||
Event.stopEvent(p_oEvent);
|
||||
|
||||
|
||||
// Hide any other Menu instances that might be visible
|
||||
|
||||
YAHOO.widget.MenuManager.hideVisible();
|
||||
|
||||
|
||||
|
||||
// Position and display the context menu
|
||||
|
||||
aXY = Event.getXY(p_oEvent);
|
||||
@ -9663,4 +9852,4 @@ toString: function() {
|
||||
}
|
||||
|
||||
}); // END YAHOO.lang.extend
|
||||
YAHOO.register("menu", YAHOO.widget.Menu, {version: "2.6.0", build: "1321"});
|
||||
YAHOO.register("menu", YAHOO.widget.Menu, {version: "2.7.0", build: "1799"});
|
||||
|
21
webdir/javascript/yui/menu/menu-min.js
vendored
21
webdir/javascript/yui/menu/menu-min.js
vendored
File diff suppressed because one or more lines are too long
459
webdir/javascript/yui/menu/menu.js
vendored
459
webdir/javascript/yui/menu/menu.js
vendored
@ -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
|
||||
*/
|
||||
|
||||
|
||||
@ -1260,7 +1260,7 @@ OFF_SCREEN_POSITION: "-999em",
|
||||
|
||||
|
||||
/**
|
||||
* @property _bHideDelayEventHandlersAssigned
|
||||
* @property _useHideDelay
|
||||
* @description Boolean indicating if the "mouseover" and "mouseout" event
|
||||
* handlers used for hiding the menu via a call to "YAHOO.lang.later" have
|
||||
* already been assigned.
|
||||
@ -1268,7 +1268,7 @@ OFF_SCREEN_POSITION: "-999em",
|
||||
* @private
|
||||
* @type Boolean
|
||||
*/
|
||||
_bHideDelayEventHandlersAssigned: false,
|
||||
_useHideDelay: false,
|
||||
|
||||
|
||||
/**
|
||||
@ -1639,9 +1639,12 @@ init: function (p_oElement, p_oConfig) {
|
||||
this.keyDownEvent.subscribe(this._onKeyDown);
|
||||
this.keyPressEvent.subscribe(this._onKeyPress);
|
||||
this.blurEvent.subscribe(this._onBlur);
|
||||
|
||||
|
||||
if (UA.gecko || UA.webkit) {
|
||||
|
||||
// Fixes an issue in Firefox 2 and Webkit where Dom's "getX" and "getY"
|
||||
// methods return values that don't take scrollTop into consideration
|
||||
|
||||
if ((UA.gecko && UA.gecko < 1.9) || UA.webkit) {
|
||||
|
||||
this.cfg.subscribeToConfigEvent(_Y, this._onYChange);
|
||||
|
||||
@ -2602,6 +2605,10 @@ _onMouseOver: function (p_sType, p_aArgs) {
|
||||
Dom.isAncestor(this.element, oTarget))) {
|
||||
|
||||
// Menu mouseover logic
|
||||
|
||||
if (this._useHideDelay) {
|
||||
this._cancelHideDelay();
|
||||
}
|
||||
|
||||
this._nCurrentMouseX = 0;
|
||||
|
||||
@ -2797,7 +2804,11 @@ _onMouseOut: function (p_sType, p_aArgs) {
|
||||
!Dom.isAncestor(this.element, oRelatedTarget)) || bMovingToSubmenu)) {
|
||||
|
||||
// Menu mouseout logic
|
||||
|
||||
|
||||
if (this._useHideDelay) {
|
||||
this._execHideDelay();
|
||||
}
|
||||
|
||||
Event.removeListener(this.element, _MOUSEMOVE, this._onMouseMove);
|
||||
|
||||
this._nCurrentMouseX = Event.getPageX(oEvent);
|
||||
@ -2846,6 +2857,7 @@ _onClick: function (p_sType, p_aArgs) {
|
||||
oItem = p_aArgs[1],
|
||||
bInMenuAnchor = false,
|
||||
oSubmenu,
|
||||
oMenu,
|
||||
oRoot,
|
||||
sId,
|
||||
sURL,
|
||||
@ -2856,16 +2868,16 @@ _onClick: function (p_sType, p_aArgs) {
|
||||
var hide = function () {
|
||||
|
||||
/*
|
||||
There is an inconsistency between Firefox 2 for Mac OS X and Firefox 2 Windows
|
||||
There is an inconsistency between Firefox for Mac OS X and Firefox Windows
|
||||
regarding the triggering of the display of the browser's context menu and the
|
||||
subsequent firing of the "click" event. In Firefox for Windows, when the user
|
||||
triggers the display of the browser's context menu the "click" event also fires
|
||||
for the document object, even though the "click" event did not fire for the
|
||||
element that was the original target of the "contextmenu" event. This is unique
|
||||
to Firefox on Windows. For all other A-Grade browsers, including Firefox 2 for
|
||||
to Firefox on Windows. For all other A-Grade browsers, including Firefox for
|
||||
Mac OS X, the "click" event doesn't fire for the document object.
|
||||
|
||||
This bug in Firefox 2 for Windows affects Menu as Menu instances listen for
|
||||
This bug in Firefox for Windows affects Menu as Menu instances listen for
|
||||
events at the document level and have an internal "click" event handler they
|
||||
use to hide themselves when clicked. As a result, in Firefox for Windows a
|
||||
Menu will hide when the user right clicks on a MenuItem to raise the browser's
|
||||
@ -2934,7 +2946,14 @@ _onClick: function (p_sType, p_aArgs) {
|
||||
|
||||
sId = sURL.substr(1, nLen);
|
||||
|
||||
bInMenuAnchor = Dom.isAncestor(this.element, sId);
|
||||
oMenu = YAHOO.widget.MenuManager.getMenu(sId);
|
||||
|
||||
if (oMenu) {
|
||||
|
||||
bInMenuAnchor =
|
||||
(this.getRoot() === oMenu.getRoot());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else if (nLen === 1) {
|
||||
@ -2947,7 +2966,6 @@ _onClick: function (p_sType, p_aArgs) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (bInMenuAnchor && !oItem.cfg.getProperty(_TARGET)) {
|
||||
|
||||
@ -3008,6 +3026,11 @@ _onKeyDown: function (p_sType, p_aArgs) {
|
||||
oParentMenu;
|
||||
|
||||
|
||||
if (this._useHideDelay) {
|
||||
this._cancelHideDelay();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
This function is called to prevent a bug in Firefox. In Firefox,
|
||||
moving a DOM element into a stationary mouse pointer will cause the
|
||||
@ -3823,8 +3846,8 @@ getConstrainedY: function (y) {
|
||||
nTopRegionHeight,
|
||||
nBottomRegionHeight,
|
||||
|
||||
topConstraint,
|
||||
bottomConstraint,
|
||||
topConstraint = scrollY + nViewportOffset,
|
||||
bottomConstraint = scrollY + viewPortHeight - nMenuOffsetHeight - nViewportOffset,
|
||||
|
||||
yNew = y;
|
||||
|
||||
@ -3908,8 +3931,7 @@ getConstrainedY: function (y) {
|
||||
var nDisplayRegionHeight = getDisplayRegionHeight(),
|
||||
bMenuHasItems = (oMenu.getItems().length > 0),
|
||||
nMenuMinScrollHeight,
|
||||
fnReturnVal,
|
||||
nNewY;
|
||||
fnReturnVal;
|
||||
|
||||
|
||||
if (nMenuOffsetHeight > nDisplayRegionHeight) {
|
||||
@ -3962,7 +3984,7 @@ getConstrainedY: function (y) {
|
||||
}
|
||||
|
||||
}
|
||||
else if (nMaxHeight && (nMaxHeight != nInitialMaxHeight)) {
|
||||
else if (nMaxHeight && (nMaxHeight !== nInitialMaxHeight)) {
|
||||
|
||||
oMenu._setScrollHeight(nInitialMaxHeight);
|
||||
oMenu.hideEvent.subscribe(resetMaxHeight);
|
||||
@ -3979,55 +4001,76 @@ getConstrainedY: function (y) {
|
||||
};
|
||||
|
||||
|
||||
if (oMenu.cfg.getProperty(_PREVENT_CONTEXT_OVERLAP) && bPotentialContextOverlap) {
|
||||
// Determine if the current value for the Menu's "y" configuration property will
|
||||
// result in the Menu being positioned outside the boundaries of the viewport
|
||||
|
||||
if (y < topConstraint || y > bottomConstraint) {
|
||||
|
||||
// The current value for the Menu's "y" configuration property WILL
|
||||
// result in the Menu being positioned outside the boundaries of the viewport
|
||||
|
||||
if (bCanConstrain) {
|
||||
|
||||
oContextEl = aContext[0];
|
||||
nContextElHeight = oContextEl.offsetHeight;
|
||||
nContextElY = (Dom.getY(oContextEl) - scrollY);
|
||||
|
||||
nTopRegionHeight = nContextElY;
|
||||
nBottomRegionHeight = (viewPortHeight - (nContextElY + nContextElHeight));
|
||||
|
||||
setVerticalPosition();
|
||||
if (oMenu.cfg.getProperty(_PREVENT_CONTEXT_OVERLAP) && bPotentialContextOverlap) {
|
||||
|
||||
}
|
||||
// SOLUTION #1:
|
||||
// If the "preventcontextoverlap" configuration property is set to "true",
|
||||
// try to flip and/or scroll the Menu to both keep it inside the boundaries of the
|
||||
// viewport AND from overlaping its context element (MenuItem or MenuBarItem).
|
||||
|
||||
yNew = oMenu.cfg.getProperty(_Y);
|
||||
|
||||
}
|
||||
else if (!(oMenu instanceof YAHOO.widget.MenuBar) && nMenuOffsetHeight >= viewPortHeight) {
|
||||
oContextEl = aContext[0];
|
||||
nContextElHeight = oContextEl.offsetHeight;
|
||||
nContextElY = (Dom.getY(oContextEl) - scrollY);
|
||||
|
||||
nAvailableHeight = (viewPortHeight - (nViewportOffset * 2));
|
||||
|
||||
if (nAvailableHeight > oMenu.cfg.getProperty(_MIN_SCROLL_HEIGHT)) {
|
||||
|
||||
oMenu._setScrollHeight(nAvailableHeight);
|
||||
oMenu.hideEvent.subscribe(resetMaxHeight);
|
||||
|
||||
alignY();
|
||||
|
||||
yNew = oMenu.cfg.getProperty(_Y);
|
||||
nTopRegionHeight = nContextElY;
|
||||
nBottomRegionHeight = (viewPortHeight - (nContextElY + nContextElHeight));
|
||||
|
||||
setVerticalPosition();
|
||||
|
||||
yNew = oMenu.cfg.getProperty(_Y);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
if (bCanConstrain) {
|
||||
|
||||
topConstraint = scrollY + nViewportOffset;
|
||||
bottomConstraint = scrollY + viewPortHeight - nMenuOffsetHeight - nViewportOffset;
|
||||
|
||||
if (y < topConstraint) {
|
||||
yNew = topConstraint;
|
||||
} else if (y > bottomConstraint) {
|
||||
yNew = bottomConstraint;
|
||||
}
|
||||
} else {
|
||||
yNew = nViewportOffset + scrollY;
|
||||
else if (!(oMenu instanceof YAHOO.widget.MenuBar) &&
|
||||
nMenuOffsetHeight >= viewPortHeight) {
|
||||
|
||||
// SOLUTION #2:
|
||||
// If the Menu exceeds the height of the viewport, introduce scroll bars
|
||||
// to keep the Menu inside the boundaries of the viewport
|
||||
|
||||
nAvailableHeight = (viewPortHeight - (nViewportOffset * 2));
|
||||
|
||||
if (nAvailableHeight > oMenu.cfg.getProperty(_MIN_SCROLL_HEIGHT)) {
|
||||
|
||||
oMenu._setScrollHeight(nAvailableHeight);
|
||||
oMenu.hideEvent.subscribe(resetMaxHeight);
|
||||
|
||||
alignY();
|
||||
|
||||
yNew = oMenu.cfg.getProperty(_Y);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
// SOLUTION #3:
|
||||
|
||||
if (y < topConstraint) {
|
||||
yNew = topConstraint;
|
||||
} else if (y > bottomConstraint) {
|
||||
yNew = bottomConstraint;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
// The "y" configuration property cannot be set to a value that will keep
|
||||
// entire Menu inside the boundary of the viewport. Therefore, set
|
||||
// the "y" configuration property to scrollY to keep as much of the
|
||||
// Menu inside the viewport as possible.
|
||||
yNew = nViewportOffset + scrollY;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -4124,13 +4167,13 @@ _onShow: function (p_sType, p_aArgs) {
|
||||
}
|
||||
|
||||
|
||||
// The following fixes an issue with the selected state of a MenuItem not rendering
|
||||
// correctly when a submenu is aligned to the left of its parent Menu instance.
|
||||
// The following fixes an issue with the selected state of a MenuItem
|
||||
// not rendering correctly when a submenu is aligned to the left of
|
||||
// its parent Menu instance.
|
||||
|
||||
if ((this.cfg.getProperty("x") < oParentMenu.cfg.getProperty("x")) &&
|
||||
(UA.gecko < 1.9) &&
|
||||
!this.cfg.getProperty(_WIDTH)) {
|
||||
|
||||
(UA.gecko && UA.gecko < 1.9) && !this.cfg.getProperty(_WIDTH)) {
|
||||
|
||||
oElement = this.element;
|
||||
nOffsetWidth = oElement.offsetWidth;
|
||||
|
||||
@ -4238,6 +4281,7 @@ _onParentMenuConfigChange: function (p_sType, p_aArgs, p_oSubmenu) {
|
||||
case _EFFECT:
|
||||
case _CLASSNAME:
|
||||
case _SCROLL_INCREMENT:
|
||||
case _MAX_HEIGHT:
|
||||
case _MIN_SCROLL_HEIGHT:
|
||||
case _MONITOR_RESIZE:
|
||||
case _SHADOW:
|
||||
@ -4298,6 +4342,8 @@ _onParentMenuRender: function (p_sType, p_aArgs, p_oSubmenu) {
|
||||
|
||||
scrollincrement: oParentCfg.getProperty(_SCROLL_INCREMENT),
|
||||
|
||||
maxheight: oParentCfg.getProperty(_MAX_HEIGHT),
|
||||
|
||||
minscrollheight: oParentCfg.getProperty(_MIN_SCROLL_HEIGHT),
|
||||
|
||||
iframe: oParentCfg.getProperty(_IFRAME),
|
||||
@ -4555,38 +4601,9 @@ configIframe: function (p_sType, p_aArgs, p_oMenu) {
|
||||
*/
|
||||
configHideDelay: function (p_sType, p_aArgs, p_oMenu) {
|
||||
|
||||
var nHideDelay = p_aArgs[0],
|
||||
oMouseOutEvent = this.mouseOutEvent,
|
||||
oMouseOverEvent = this.mouseOverEvent,
|
||||
oKeyDownEvent = this.keyDownEvent;
|
||||
var nHideDelay = p_aArgs[0];
|
||||
|
||||
if (nHideDelay > 0) {
|
||||
|
||||
/*
|
||||
Only assign event handlers once. This way the user change
|
||||
the value for the hidedelay as many times as they want.
|
||||
*/
|
||||
|
||||
if (!this._bHideDelayEventHandlersAssigned) {
|
||||
|
||||
oMouseOutEvent.subscribe(this._execHideDelay);
|
||||
oMouseOverEvent.subscribe(this._cancelHideDelay);
|
||||
oKeyDownEvent.subscribe(this._cancelHideDelay);
|
||||
|
||||
this._bHideDelayEventHandlersAssigned = true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
oMouseOutEvent.unsubscribe(this._execHideDelay);
|
||||
oMouseOverEvent.unsubscribe(this._cancelHideDelay);
|
||||
oKeyDownEvent.unsubscribe(this._cancelHideDelay);
|
||||
|
||||
this._bHideDelayEventHandlersAssigned = false;
|
||||
|
||||
}
|
||||
this._useHideDelay = (nHideDelay > 0);
|
||||
|
||||
},
|
||||
|
||||
@ -4648,7 +4665,6 @@ _setScrollHeight: function (p_nScrollHeight) {
|
||||
oBody,
|
||||
oHeader,
|
||||
oFooter,
|
||||
oParent,
|
||||
fnMouseOver,
|
||||
fnMouseOut,
|
||||
nMinScrollHeight,
|
||||
@ -4666,7 +4682,6 @@ _setScrollHeight: function (p_nScrollHeight) {
|
||||
fnMouseOver = this._onScrollTargetMouseOver;
|
||||
fnMouseOut = this._onScrollTargetMouseOut;
|
||||
nMinScrollHeight = this.cfg.getProperty(_MIN_SCROLL_HEIGHT);
|
||||
oParent = this.parent;
|
||||
|
||||
|
||||
if (nScrollHeight > 0 && nScrollHeight < nMinScrollHeight) {
|
||||
@ -4681,24 +4696,26 @@ _setScrollHeight: function (p_nScrollHeight) {
|
||||
oBody.scrollTop = 0;
|
||||
|
||||
|
||||
/*
|
||||
There is a bug in gecko-based browsers where an element whose
|
||||
"position" property is set to "absolute" and "overflow" property is set
|
||||
to "hidden" will not render at the correct width when its
|
||||
offsetParent's "position" property is also set to "absolute." It is
|
||||
possible to work around this bug by specifying a value for the width
|
||||
property in addition to overflow.
|
||||
// Need to set a width for the Menu to fix the following problems in
|
||||
// Firefox 2 and IE:
|
||||
|
||||
// #1) Scrolled Menus will render at 1px wide in Firefox 2
|
||||
|
||||
// #2) There is a bug in gecko-based browsers where an element whose
|
||||
// "position" property is set to "absolute" and "overflow" property is
|
||||
// set to "hidden" will not render at the correct width when its
|
||||
// offsetParent's "position" property is also set to "absolute." It is
|
||||
// possible to work around this bug by specifying a value for the width
|
||||
// property in addition to overflow.
|
||||
|
||||
// #3) In IE it is necessary to give the Menu a width before the
|
||||
// scrollbars are rendered to prevent the Menu from rendering with a
|
||||
// width that is 100% of the browser viewport.
|
||||
|
||||
In IE it is also necessary to give the Menu a width before the scrollbars are
|
||||
rendered to prevent the Menu from rendering with a width that is 100% of
|
||||
the browser viewport.
|
||||
*/
|
||||
|
||||
bSetWidth = ((UA.gecko && oParent && oParent.parent &&
|
||||
oParent.parent.cfg.getProperty(_POSITION) == _DYNAMIC) || UA.ie);
|
||||
bSetWidth = ((UA.gecko && UA.gecko < 1.9) || UA.ie);
|
||||
|
||||
if (nScrollHeight > 0 && bSetWidth && !this.cfg.getProperty(_WIDTH)) {
|
||||
|
||||
|
||||
nOffsetWidth = oElement.offsetWidth;
|
||||
|
||||
/*
|
||||
@ -5111,7 +5128,7 @@ configShadow: function (p_sType, p_aArgs, p_oMenu) {
|
||||
|
||||
|
||||
var onBeforeShow = function () {
|
||||
|
||||
|
||||
if (this._shadow) {
|
||||
|
||||
// If called because the "shadow" event was refired - just append again and resize
|
||||
@ -6380,7 +6397,7 @@ initDefaultConfig: function () {
|
||||
/**
|
||||
* @config keepopen
|
||||
* @description Boolean indicating if the menu should remain open when clicked.
|
||||
* @default flase
|
||||
* @default false
|
||||
* @type Boolean
|
||||
*/
|
||||
oConfig.addProperty(
|
||||
@ -6472,9 +6489,7 @@ var Dom = YAHOO.util.Dom,
|
||||
_OPTION = "OPTION",
|
||||
_OPTGROUP = "OPTGROUP",
|
||||
_LI_UPPERCASE = "LI",
|
||||
_LI_LOWERCASE = "li",
|
||||
_HREF = "href",
|
||||
_ANCHOR_TEMPLATE = "<a href=\"#\"></a>",
|
||||
_SELECT = "SELECT",
|
||||
_DIV = "DIV",
|
||||
_START_HELP_TEXT = "<em class=\"helptext\">",
|
||||
@ -6489,6 +6504,11 @@ var Dom = YAHOO.util.Dom,
|
||||
_VISIBLE = "visible",
|
||||
_SPACE = " ",
|
||||
_MENUITEM = "MenuItem",
|
||||
_CLICK = "click",
|
||||
_SHOW = "show",
|
||||
_HIDE = "hide",
|
||||
_LI_LOWERCASE = "li",
|
||||
_ANCHOR_TEMPLATE = "<a href=\"#\"></a>",
|
||||
|
||||
EVENT_TYPES = [
|
||||
|
||||
@ -6496,7 +6516,7 @@ var Dom = YAHOO.util.Dom,
|
||||
["mouseOutEvent", "mouseout"],
|
||||
["mouseDownEvent", "mousedown"],
|
||||
["mouseUpEvent", "mouseup"],
|
||||
["clickEvent", "click"],
|
||||
["clickEvent", _CLICK],
|
||||
["keyPressEvent", "keypress"],
|
||||
["keyDownEvent", "keydown"],
|
||||
["keyUpEvent", "keyup"],
|
||||
@ -6587,9 +6607,15 @@ var Dom = YAHOO.util.Dom,
|
||||
suppressEvent: true
|
||||
},
|
||||
|
||||
CLASS_NAMES = {},
|
||||
|
||||
m_oMenuItemTemplate;
|
||||
KEY_LISTENER_CONFIG = {
|
||||
key: "keylistener",
|
||||
value: null,
|
||||
suppressEvent: true
|
||||
},
|
||||
|
||||
m_oMenuItemTemplate = null,
|
||||
|
||||
CLASS_NAMES = {};
|
||||
|
||||
|
||||
/**
|
||||
@ -7134,7 +7160,7 @@ MenuItem.prototype = {
|
||||
|
||||
oAnchor = oElement.firstChild;
|
||||
oAnchor.className = this.CSS_LABEL_CLASS_NAME;
|
||||
|
||||
|
||||
this.element = oElement;
|
||||
this._oAnchor = oAnchor;
|
||||
|
||||
@ -7818,6 +7844,150 @@ MenuItem.prototype = {
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* @method _dispatchClickEvent
|
||||
* @description Dispatches a DOM "click" event to the anchor element of a
|
||||
* MenuItem instance.
|
||||
* @private
|
||||
*/
|
||||
_dispatchClickEvent: function () {
|
||||
|
||||
var oMenuItem = this,
|
||||
oAnchor,
|
||||
oEvent;
|
||||
|
||||
if (!oMenuItem.cfg.getProperty(_DISABLED)) {
|
||||
|
||||
oAnchor = Dom.getFirstChild(oMenuItem.element);
|
||||
|
||||
// Dispatch a "click" event to the MenuItem's anchor so that its
|
||||
// "click" event handlers will get called in response to the user
|
||||
// pressing the keyboard shortcut defined by the "keylistener"
|
||||
// configuration property.
|
||||
|
||||
if (UA.ie) {
|
||||
oAnchor.fireEvent(_ONCLICK);
|
||||
}
|
||||
else {
|
||||
|
||||
if ((UA.gecko && UA.gecko >= 1.9) || UA.opera || UA.webkit) {
|
||||
|
||||
oEvent = document.createEvent("HTMLEvents");
|
||||
oEvent.initEvent(_CLICK, true, true);
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
oEvent = document.createEvent("MouseEvents");
|
||||
oEvent.initMouseEvent(_CLICK, true, true, window, 0, 0, 0,
|
||||
0, 0, false, false, false, false, 0, null);
|
||||
|
||||
}
|
||||
|
||||
oAnchor.dispatchEvent(oEvent);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* @method _createKeyListener
|
||||
* @description "show" event handler for a Menu instance - responsible for
|
||||
* setting up the KeyListener instance for a MenuItem.
|
||||
* @private
|
||||
* @param {String} type String representing the name of the event that
|
||||
* was fired.
|
||||
* @param {Array} args Array of arguments sent when the event was fired.
|
||||
* @param {Array} keyData Array of arguments sent when the event was fired.
|
||||
*/
|
||||
_createKeyListener: function (type, args, keyData) {
|
||||
|
||||
var oMenuItem = this,
|
||||
oMenu = oMenuItem.parent;
|
||||
|
||||
var oKeyListener = new YAHOO.util.KeyListener(
|
||||
oMenu.element.ownerDocument,
|
||||
keyData,
|
||||
{
|
||||
fn: oMenuItem._dispatchClickEvent,
|
||||
scope: oMenuItem,
|
||||
correctScope: true });
|
||||
|
||||
|
||||
if (oMenu.cfg.getProperty(_VISIBLE)) {
|
||||
oKeyListener.enable();
|
||||
}
|
||||
|
||||
|
||||
oMenu.subscribe(_SHOW, oKeyListener.enable, null, oKeyListener);
|
||||
oMenu.subscribe(_HIDE, oKeyListener.disable, null, oKeyListener);
|
||||
|
||||
oMenuItem._keyListener = oKeyListener;
|
||||
|
||||
oMenu.unsubscribe(_SHOW, oMenuItem._createKeyListener, keyData);
|
||||
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* @method configKeyListener
|
||||
* @description Event handler for when the "keylistener" configuration
|
||||
* property of a menu item changes.
|
||||
* @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.
|
||||
*/
|
||||
configKeyListener: function (p_sType, p_aArgs) {
|
||||
|
||||
var oKeyData = p_aArgs[0],
|
||||
oMenuItem = this,
|
||||
oMenu = oMenuItem.parent;
|
||||
|
||||
if (oMenuItem._keyData) {
|
||||
|
||||
// Unsubscribe from the "show" event in case the keylistener
|
||||
// config was changed before the Menu was ever made visible.
|
||||
|
||||
oMenu.unsubscribe(_SHOW,
|
||||
oMenuItem._createKeyListener, oMenuItem._keyData);
|
||||
|
||||
oMenuItem._keyData = null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Tear down for the previous value of the "keylistener" property
|
||||
|
||||
if (oMenuItem._keyListener) {
|
||||
|
||||
oMenu.unsubscribe(_SHOW, oMenuItem._keyListener.enable);
|
||||
oMenu.unsubscribe(_HIDE, oMenuItem._keyListener.disable);
|
||||
|
||||
oMenuItem._keyListener.disable();
|
||||
oMenuItem._keyListener = null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (oKeyData) {
|
||||
|
||||
oMenuItem._keyData = oKeyData;
|
||||
|
||||
// Defer the creation of the KeyListener instance until the
|
||||
// parent Menu is visible. This is necessary since the
|
||||
// KeyListener instance needs to be bound to the document the
|
||||
// Menu has been rendered into. Deferring creation of the
|
||||
// KeyListener instance also improves performance.
|
||||
|
||||
oMenu.subscribe(_SHOW, oMenuItem._createKeyListener,
|
||||
oKeyData, oMenuItem);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
|
||||
// Public methods
|
||||
|
||||
@ -8078,6 +8248,25 @@ MenuItem.prototype = {
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* @config keylistener
|
||||
* @description Object literal representing the key(s) that can be used
|
||||
* to trigger the MenuItem's "click" event. Possible attributes are
|
||||
* shift (boolean), alt (boolean), ctrl (boolean) and keys (either an int
|
||||
* or an array of ints representing keycodes).
|
||||
* @default null
|
||||
* @type Object
|
||||
*/
|
||||
oConfig.addProperty(
|
||||
KEY_LISTENER_CONFIG.key,
|
||||
{
|
||||
handler: this.configKeyListener,
|
||||
value: KEY_LISTENER_CONFIG.value,
|
||||
suppressEvent: KEY_LISTENER_CONFIG.suppressEvent
|
||||
}
|
||||
);
|
||||
|
||||
},
|
||||
|
||||
|
||||
@ -8697,29 +8886,29 @@ _onTriggerContextMenu: function(p_oEvent, p_oMenu) {
|
||||
var aXY;
|
||||
|
||||
if (!(p_oEvent.type == _MOUSEDOWN && !p_oEvent.ctrlKey)) {
|
||||
|
||||
/*
|
||||
Prevent the browser's default context menu from appearing and
|
||||
stop the propagation of the "contextmenu" event so that
|
||||
other ContextMenu instances are not displayed.
|
||||
*/
|
||||
|
||||
Event.stopEvent(p_oEvent);
|
||||
|
||||
|
||||
this.contextEventTarget = Event.getTarget(p_oEvent);
|
||||
|
||||
this.triggerContextMenuEvent.fire(p_oEvent);
|
||||
|
||||
|
||||
// Hide any other Menu instances that might be visible
|
||||
|
||||
YAHOO.widget.MenuManager.hideVisible();
|
||||
|
||||
|
||||
|
||||
if (!this._bCancelled) {
|
||||
|
||||
/*
|
||||
Prevent the browser's default context menu from appearing and
|
||||
stop the propagation of the "contextmenu" event so that
|
||||
other ContextMenu instances are not displayed.
|
||||
*/
|
||||
|
||||
Event.stopEvent(p_oEvent);
|
||||
|
||||
|
||||
// Hide any other Menu instances that might be visible
|
||||
|
||||
YAHOO.widget.MenuManager.hideVisible();
|
||||
|
||||
|
||||
|
||||
// Position and display the context menu
|
||||
|
||||
aXY = Event.getXY(p_oEvent);
|
||||
@ -9616,4 +9805,4 @@ toString: function() {
|
||||
}
|
||||
|
||||
}); // END YAHOO.lang.extend
|
||||
YAHOO.register("menu", YAHOO.widget.Menu, {version: "2.6.0", build: "1321"});
|
||||
YAHOO.register("menu", YAHOO.widget.Menu, {version: "2.7.0", build: "1799"});
|
||||
|
Reference in New Issue
Block a user