node-menunav-debug.js revision 7b00f3fda5c8d6bdb30fa5f633a3330b7141df55
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync* <p>The MenuNav Node Plugin makes it easy to transform existing list-based
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync* markup into traditional, drop down navigational menus that are both accessible
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync* and easy to customize, and only require a small set of dependencies.</p>
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync* <p>To use the MenuNav Node Plugin, simply pass a reference to the plugin to a
944af4e9c55b259413ffc0fb9429da524a3685c6vboxsync* Node instance's <code>plug</code> method.</p>
14d0566627e0dd5853cae37a1ae7b8e28a99e0f5vboxsync* <script type="text/javascript"> <br>
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync* // Call the "use" method, passing in "node-menunav". This will <br>
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync* // load the script and CSS for the MenuNav Node Plugin and all of <br>
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync* // the required dependencies. <br>
2e6dc32bcc9c3a3e70c957764c033b1f402bc617vboxsync* YUI().use("node-menunav", function(Y) { <br>
c12885bf3de22fa504a7b9ddc41473b485d9ab25vboxsync* // Use the "contentready" event to initialize the menu when <br>
2e6dc32bcc9c3a3e70c957764c033b1f402bc617vboxsync* // the subtree of element representing the root menu <br>
2e6dc32bcc9c3a3e70c957764c033b1f402bc617vboxsync* // (<div id="menu-1">) is ready to be scripted. <br>
a7ba3d5f31ca70d04a3933e570374e5ec5eff84avboxsync* Y.on("contentready", function () { <br>
cb0578a5309e1fc264e5a4acc30543bea075be43vboxsync* // The scope of the callback will be a Node instance <br>
a7ba3d5f31ca70d04a3933e570374e5ec5eff84avboxsync* // representing the root menu (<div id="menu-1">). <br>
8cfe2efff2058bd07777056112155ea5353dcfbavboxsync* // Therefore, since "this" represents a Node instance, it <br>
8cfe2efff2058bd07777056112155ea5353dcfbavboxsync* // is possible to just call "this.plug" passing in a <br>
8cfe2efff2058bd07777056112155ea5353dcfbavboxsync* // reference to the MenuNav Node Plugin. <br>
8cfe2efff2058bd07777056112155ea5353dcfbavboxsync* this.plug(Y.Plugin.NodeMenuNav); <br>
ea1cc8df95dba6fca9c36c94f565ef95c7802a36vboxsync* }, "#menu-1"); <br>
8cfe2efff2058bd07777056112155ea5353dcfbavboxsync* </script> <br>
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync* <p>The MenuNav Node Plugin has several configuration properties that can be
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync* set via an object literal that is passed as a second argument to a Node
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync* instance's <code>plug</code> method.
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync* <script type="text/javascript"> <br>
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync* // Call the "use" method, passing in "node-menunav". This will <br>
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync* // load the script and CSS for the MenuNav Node Plugin and all of <br>
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync* // the required dependencies. <br>
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync* YUI().use("node-menunav", function(Y) { <br>
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync* // Use the "contentready" event to initialize the menu when <br>
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync* // the subtree of element representing the root menu <br>
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync* // (<div id="menu-1">) is ready to be scripted. <br>
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync* Y.on("contentready", function () { <br>
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync* // The scope of the callback will be a Node instance <br>
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync* // representing the root menu (<div id="menu-1">). <br>
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync* // Therefore, since "this" represents a Node instance, it <br>
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync* // is possible to just call "this.plug" passing in a <br>
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync* // reference to the MenuNav Node Plugin. <br>
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync* this.plug(Y.Plugin.NodeMenuNav, { mouseOutHideDelay: 1000 });
b0d3e712c0bf759a686c718a55896f19804cfa75vboxsync* }, "#menu-1"); <br>
b0d3e712c0bf759a686c718a55896f19804cfa75vboxsync* </script> <br>
b0d3e712c0bf759a686c718a55896f19804cfa75vboxsync* @module node-menunav
b0d3e712c0bf759a686c718a55896f19804cfa75vboxsync // Util shortcuts
b0d3e712c0bf759a686c718a55896f19804cfa75vboxsync // Frequently used strings
b0d3e712c0bf759a686c718a55896f19804cfa75vboxsync ACTIVE_DESCENDANT_CHANGE = ACTIVE_DESCENDANT + "Change",
b0d3e712c0bf759a686c718a55896f19804cfa75vboxsync // Attribute keys
b0d3e712c0bf759a686c718a55896f19804cfa75vboxsync // CSS class names
b0d3e712c0bf759a686c718a55896f19804cfa75vboxsync CSS_MENU_HORIZONTAL = getClassName(MENU, "horizontal"),
b0d3e712c0bf759a686c718a55896f19804cfa75vboxsync CSS_MENU_LABEL_ACTIVE = getClassName(MENU, LABEL, ACTIVE),
b0d3e712c0bf759a686c718a55896f19804cfa75vboxsync CSS_MENU_LABEL_MENUVISIBLE = getClassName(MENU, LABEL, (MENU + "visible")),
b0d3e712c0bf759a686c718a55896f19804cfa75vboxsync CSS_MENUITEM_ACTIVE = getClassName(MENUITEM, ACTIVE),
b0d3e712c0bf759a686c718a55896f19804cfa75vboxsync // CSS selectors
b0d3e712c0bf759a686c718a55896f19804cfa75vboxsync MENU_TOGGLE_SELECTOR = (PERIOD + getClassName(MENU, "toggle")),
cb0578a5309e1fc264e5a4acc30543bea075be43vboxsync MENU_CONTENT_SELECTOR = PERIOD + getClassName(MENU, CONTENT),
b0d3e712c0bf759a686c718a55896f19804cfa75vboxsync STANDARD_QUERY = ">" + MENU_CONTENT_SELECTOR + ">ul>li>a",
b0d3e712c0bf759a686c718a55896f19804cfa75vboxsync EXTENDED_QUERY = ">" + MENU_CONTENT_SELECTOR + ">ul>li>" + MENU_LABEL_SELECTOR + ">a:first-child";
b0d3e712c0bf759a686c718a55896f19804cfa75vboxsync// Utility functions
b0d3e712c0bf759a686c718a55896f19804cfa75vboxsync oNext = node.get(PARENT_NODE).get(CHILDREN).item(0);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync bReturnVal = node.get("nodeName").toLowerCase() === LOWERCASE_A;
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync return menuLabel.hasClass(CSS_MENU_LABEL_MENUVISIBLE);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync return isAnchor(node) ? node : node.one(LOWERCASE_A);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsyncvar getNodeWithClass = function (node, className, searchAncestors) {
var oItem;
if (node) {
return oItem;
var oItem;
if (node) {
if (searchAncestors) {
return oItem;
var oItem;
if (node) {
return oItem;
* the <a href="Node.html#method_plug"><code>plug</code></a> method of Node and
var NodeMenuNav = function () {
useARIA: {
value: true,
writeOnce: true,
lazyAdd: false,
sID;
if (value) {
if (oMenuToggle) {
if (oSubmenu) {
if (oMenuToggle) {
value: true,
writeOnce: true
writeOnce: true
writeOnce: true
writeOnce: true
_rootMenu: null,
_activeItem: null,
_activeMenu: null,
_hasFocus: false,
_blockMouseEvent: false,
_movingToSubmenu: false,
_showSubmenuTimer: null,
_hideSubmenuTimer: null,
_hideAllSubmenusTimer: null,
_firstItem: null,
var menuNav = this,
aHandlers = [],
oDoc;
if (oRootMenu) {
destructor: function () {
if (aHandlers) {
this._eventHandlers = null;
var menuNav = this,
if (!oMenu) {
return returnVal;
_clearActiveItem: function () {
var menuNav = this,
if (oActiveItem) {
var menuNav = this;
if (item) {
var menuNav = this,
var menuNav = this,
if (activateAndFocusLabel) {
if (oActiveItem) {
var menuNav = this;
}, menuNav));
_cancelShowSubmenuTimer: function () {
var menuNav = this,
if (oShowSubmenuTimer) {
_cancelHideSubmenuTimer: function () {
var menuNav = this,
if (oHideSubmenuTimer) {
_initFocusManager: function () {
var menuNav = this,
if (!oFocusManager) {
circular: true
var oItem;
var menuNav = this,
if (oActiveItem) {
var menuNav = this,
if (oHideAllSubmenusTimer) {
_hideAndFocusLabel: function () {
var menuNav = this,
if (oActiveMenu) {
var menuNav = this,
if (oActiveItem) {
var menuNav = this,
if (oSubmenu) {
var menuNav = this,
if (bUseAutoSubmenuDisplay) {
(oRelatedTarget &&
var menuNav = this,
this._clearActiveItem();
var menuNav = this,
bPreventDefault = false,
oLI,
switch (nKeyCode) {
if (oItem) {
if (oSubmenu) {
bPreventDefault = true;
if (oSubmenu) {
if (oItem) {
if (oSubmenu) {
bPreventDefault = true;
if (bPreventDefault) {
var menuNav = this,
bPreventDefault = false,
if (oSubmenu) {
bPreventDefault = true;
if (bPreventDefault) {
var menuNav = this;
var menuNav = this,
if (oParentMenu) {
var menuNav = this,
bMovingToSubmenu = false,
if (oMenuLabel) {
bMovingToSubmenu = true;
var menuNav = this,
nLen,
sId;
if (oMenuLabel) {
if (oAnchor) {
// http://msdn.microsoft.com/en-us/library/ms536429(VS.85).aspx
var menuNav = this,
if (oActiveMenu) {
else if (oActiveItem) {
if (oSubmenu) {
var menuNav = this,