WebFX WebBoard
Message Thread:
View All Messages
Back to WebFX
 Bug in DHTML Menu 4.3, Mike Wagner, October 16, 2004

Subject: Bug in DHTML Menu 4.3 From: Mike Wagner Date: October 16, 2004

Tripped on a bug in the new version of DHTML Menu. (It may have been there for a while. I was upgrading from 4.23.) If you one of the menus in the menubar is given a mnemonic that isn't a character in the menu title, the title gets replaced with that of the previous menu in the menubar. The bug comes from the getTextHtml() method on the MenuItem object. The method doesn't check the return value of the regexp.exec() call. At least in IE 6.0, you can't trust the static RegExp.index to indicate if there was a match. You need to check if the exec() call returns null. Here's my patch code that fixed it for me:

MenuItem.prototype.getTextHtml = function () {
 var s = this.text;
 if ( !s || !this.mnemonic )
  return s;
 // replace character with <u> character </u>
 // /^(((<([^>]|MNEMONIC)+>)|[^MNEMONIC])*)(MNEMONIC)/i
 var re = new RegExp( "^(((<([^>]|" + this.mnemonic + ")+>)|[^<" +
      this.mnemonic + "])*)(" + this.mnemonic + ")", "i" );
 var reResult = re.exec( s ); //Added 10/15/04, MEW
 if ( reResult != null && RegExp.index != -1 && RegExp.$5 != "" )
  return RegExp.$1 + "<u>" + RegExp.$5 + "</u>" + RegExp.rightContext;
  return s;


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