WebFX WebBoard
Message Thread:
View All Messages
Back to WebFX
 menu4 menuitem index bug, Winfield, August 20, 2003
     Re:menu4 menuitem index bug, Erik Arvidsson, August 24, 2003

Subject: Re:menu4 menuitem index bug From: Erik Arvidsson Date: August 24, 2003
You are correct. I wonder how that slipped through :-) I'll include a fix for this the next time I update it.

erik

_____________________________________________________

Hi,
Found a bug in the latest version of menu4. When you add a menuitem to a menu with the beforeMi parameter the itemIndex properties of the menuItems are thrown off:
Menu.prototype.add = function ( mi, beforeMi ) {
if ( beforeMi != null ) {
var items = this.items;
var l = items.length;
for ( var i = 0; i < l; i++ ) {
if ( items[i] == beforeMi )
break;
}
this.items = items.slice( 0, i ).concat( mi ).concat( items.slice( i, l ) );
}
else
this.items.push( mi );
mi.parentMenu = this;
mi.itemIndex = this.items.length - 1;
if ( mi.subMenu ) {
mi.subMenu.parentMenu = this;
mi.subMenu.parentMenuItem = mi;
}
return mi;
};



Reply
Name: 
Email: 
Subject: 

Enter your reply to this message below. HTML tags are not supported but words that start with http://, ftp:// or mailto: are converted to links.


View All Messages
Back to WebFX