I'm surprised this code is not backward compatible; I didnt' write it
but someone used a trick of appending an A tag, then assign onblur
event to it, to get it to propagate. Works fine in Firefox 2.
I did some reading; seemed like I should be able to use
addEventListener for Firefox 3 but still doesn't work; anyone see what
I'm doing wrong here?
(this.handleOnBlur never gets called when focus of this.frame (div
tag) is blurred by mouse click)
thanks,
jeff-
Note: 'frame' is a reserved object name but doesnt' seem to be a
problem
if (window.addEventListener) { // <-- Firefox 3 takes
this route
//this.frame.focus();
//this.frame.parentSubmenu = this;
this.frame.addEventListener("blur", this.handleOnBlur, true) //
invoke function
}
else if (browser.useABlur) { // <-- Firefox 2 took this
route before... // If we need to use a hidden 'A' element for the
onBlur event
this.emptyA = document.createElement('A');
this.frame.appendChild(this.emptyA);
this.emptyA.focus();
this.emptyA.parentSubmenu = this;
this.emptyA.onblur = this.handleOnBlur;
}
else { // <-- IE route
this.frame.focus();
this.frame.parentSubmenu = this;
this.frame.onblur = this.handleOnBlur;
}
If an A tag is defined to give a parent element (div) focus, IT MUST
HAVE the href attribute set or it will not provide focus, thus onblur
will never fire.
Firefox 2 did not require this. Thus, Firefox 3 probably breaks a lot
of DHTML menus...
This seems like 'anal bullshit', requiring this, when previous FF
versions did not.
I recognize this may be a layout engine 'enhancement' but it's
certainly not backward compatible and it breaks the web (bad).
if (window.addEventListener) { // hidden 'A' element for
onBlur event
this.emptyA = document.createElement('A');
this.emptyA.href = "#"; // <-- FireFox 3 REQUIRES an HREF
this.dframe.appendChild(this.emptyA);