Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

blur event propagation compared to Firefox 2

8 views
Skip to first unread message

Jeff Papineau

unread,
Jun 19, 2008, 5:37:09 PM6/19/08
to surf...@gmail.com

In Firefox 3 our web app menus stopped dismissing on blur. The code
below is an example of this, and how I first attempted a fix.

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;
}

Jeff Papineau

unread,
Jul 15, 2008, 3:20:12 PM7/15/08
to
Firefox 3 bug?

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);

0 new messages