HierMenus CENTRAL: HierMenus In Progress. HierMenus 5.2 Release Notes (6/6) | WebReference

HierMenus CENTRAL: HierMenus In Progress. HierMenus 5.2 Release Notes (6/6)

To page 1To page 2To page 3To page 4To page 5current page

Other Notable Changes in HierMenus 5.2

Opera 7 and the Missing Window

When specifically reloading a single page in a frame (i.e., using the right-click context menu and selecting Frame/Reload), any code that existed within that frame and can still be executed (such as might be the case with handlers that are assigned to objects in a different frame) "loses" its reference to the window object and/or built-in variables of the initial window object. Defining this function in a navigation page:

function theHandler() {

and attaching it as the handler of an object in the content frame, manually reloading the navigation frame and then triggering the handler will result in an error that looks something like this:

Reference to undefined variable: 
No such variable 'window'

To account for and correct this, we simply add this try..catch block to our new HM_f_CheckMenuSync function (described on the previous page):

try{var CheckWindow=self;}
catch(e){return false;}

Since this new HM_f_CheckMenuSync function is called as part of HM_f_DocumentCheck (which is called on entry to each event handler), this should effectively prevent us from attempting to execute any further code when within this rare "missing window" situation.

Separate Code Base for Opera 7

The number and depth of Opera specific changes required to deal with the issues described on the previous two pages has necessitated the creation of a fourth HM script specifically for Opera 7's use: HM_ScriptOPR.js. This new script will be included with the HM download distribution beginning with HM 5.2 and the included HM_Loader.js file has also been updated to recognize the new script.

We realize the inclusion of an additional script makes life a bit tougher for those who need to apply direct customizations to HM; and we apologize in advance for this inconvenience. However, with the amount of customized branching and independent logic required to address our Opera-related concerns, we felt that the separation of the code was inevitable (and helps us to more quickly isolate Opera specific workarounds). On a brighter note, the resulting HM_ScriptDOM file is slightly smaller in HM 5.2 than it was in HM 5.1; even with the addition of the menu creation and Keep In Window override logic described at the outset of this article.

Cross-Frame Menu Building in Safari

While testing some cross-frames pages in Safari, we noted that occasionally--especially on larger pages--menus would be built as if they contained no content; i.e., the "menu" would consist entirely of the collapsed menu border, set to the menu's width. We traced this back to the menu rebuilding process as you move from page to page in cross-frames scenarios, finding that in some cases Safari can begin rebuilding the menus too soon--before the content page document has finished rendering.

Further analysis revealed that Safari supports the Internet Explorer-like document.readyState property, and therefore the fix for this problem was quite easy: we simply route the Safari reload process through the same code that Internet Explorer uses:

if(!HM_FrameHasLoadHandler) {
// 5.2
// if(HM_IE) HM_f_IEMainUnloadHandler();
   if(HM_IE||HM_IsSafari) HM_f_IEMainUnloadHandler();
   else HM_f_NSMainUnloadHandler();

Variable Width Menus Are Too Wide

Last but not least, we're correcting a problem in which certain variable width menus are created wider than they should be.

Our original documentation for the HM_GL_MenuWidth parameter indicates that, for variable-width menus, the HM_GL_MenuWidth setting represents the maximum width for the menus created. And this is indeed the case. Most of the time.

The exception comes from menus with individual items which cannot be wrapped to a length shorter than or equal to this maximum width. Such an item could include a long, single, unhyphenated word or a wide image, for example. In this case, HM versions prior to 5.2 will render the menus to the width of that single wide item in many browsers (pretty much all browsers other than Gecko, in fact), instead of enforcing the set maximum width as defined within your configurations.

At issue here is our use of scrollWidth to tell us exactly how wide a menu item is after it's been created and initialized. Even though our menu widths are initially set to the width as specified in the MenuWidth parameters, this scrollWidth variable can--if the menu item contains a single wide item as described above--report a width wider than the initial width of the menu.

HM 5.2 has been changed to honor the set MenuWidth parameter, as per our documentation, and ensure that even if a single item is wider than the menu width, the menu itself will not expand to account for that item. If you need this behavior in your HM implementations, we recommend that you simply increase your MenuWidth setting to be wider than the widest expected item of your menu sets. And remember: the problem only applies to variable-width menus that contain a single, unwrappable item that is wider then the MenuWidth setting.

Closely related to the above is some specific situations where the variable width menus would not properly account for the existence of the more image, resulting in menu items where the menu item description would run over the more image itself, even though the overall menu width was well short of the defined maximum. We've ironed out the responsible HM_f_FixSize logic and believe we've corrected this error, which only affected Gecko (all) and Internet Explorer/Opera browsers (when running in Standards mode).


As always, we thank our ever-growing user base both for their continued use and their suggestions for improvement. Both the Keep In Window overrides and the new menu creation options are the direct result of user suggestions, so keep those great ideas coming!

Files Changed in HM 5.2

To page 1To page 2To page 3To page 4To page 5current page

Created: August 28, 2003
Revised: August 28, 2003

URL: http://www.webreference.com/dhtml/hiermenus/inprogress/7/5.html

Justtechjobs.comFind a programming school near you

Online Campus Both