// SpryMenuBarIEWorkaroundsPlugin.js - version 0.8 - Spry Pre-Release 1.7 // // Copyright (c) 2010. Adobe Systems Incorporated. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // * Neither the name of Adobe Systems Incorporated nor the names of its // contributors may be used to endorse or promote products derived from this // software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. (function() { // BeginSpryComponent if (typeof Spry == "undefined" || !Spry.Widget || !Spry.Widget.MenuBar2) { alert("SpryMenuBarIEWorkaroundsPlugin.js requires SpryMenu.js!"); return; } var isIE6 = (window.ActiveXObject && !window.XMLHttpRequest); if (isIE6) Spry.Utils.addClassName(document.documentElement, "SpryIsIE6"); var isIE = window.ActiveXObject ? true : false; // This plugin attempts to workaround the following problems with IE6, IE7 and IE8: // // A. Submenus render underneath that // use native windows. // // B. Multiple class selectors are not supported (IE6). // // - IE6 does not support selectors that make use of multiple class names on a single element. // For example a selector of the form .MenuItemWithSubMenu.MenuItemHover will be interpreted // by IE6 as simply .MenuItemHover. To workaround this problem set the 'useCombinedClassNames' // option for the plugin (true by default) which will generate combined class names such as // .MenuItemWithSubMenuHover, .MenuItemFirstHover, .MenuItemFirstWithSubMenuHover, etc. Class // names generated by this plugin are as follows: // // MenuItemFirstWithSubMenu // MenuItemLastWithSubMenu // MenuItemFirstHover // MenuItemLastHover // MenuItemWithSubMenuHover // MenuItemFirstWithSubMenuHover // MenuItemLastWithSubMenuHover // // C. Elements with position values other than 'static' establish a new z-index context (IE6). // // - This problem manifests itself when subMenus overlap. You will see subMenus rendering // behind menu items that come after the subMenu's parent menu item. The solution for this // is to set the z-index of the entire subMenu parent element hierarchy such that they are // higher than any of their siblings. By default, the plugin will place a z-index of 1000 // on all parents of the currentSubMenu. You can change the z-index value by passing the // 'miContainerZIndex' option with the desired z-index integer value. If you would prefer // to control the z-index via a CSS rule, set the 'miContainerHoverZIndex' option to undefined, // and then use the class 'MenuItemContainerHover' in your stylesheet to set the desired // z-index value. // // You can read more about this problem here: // // http://www.adobe.com/cfusion/communityengine/index.cfm?event=showdetails&postId=829&productId=1&loc=en_US // // D.
  • elements that contain elements render with gaps below them. (IE6-IE8) // // - This one is a doozy to work around. For menu items with no subMenus, you can get rid of gaps // by using this CSS trick: // // http://www.adobe.com/cfusion/communityengine/index.cfm?event=showdetails&postId=824&productId=1&loc=en_US // // But the trick above does not work for menu items with sub menus since once they become // visible, IE6 adds the gap. There are all sorts of tricks that work in specific scenarios, // that involve setting the
  • to inline and floating, etc, etc. But that doesn't seem to work // in every styling case/situation. IE8 is especially sneaky, since the problem seems to be // sensitive to the specific characters in the whitespace too, so can crop up after seemingly innocuous changes. // The only fool-proof way to get rid of this problem is to get rid of the