Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #13255

Re: Event Bubbling: Bubble, Bubble, Toil, and Trouble

From Matt McDonald <matt@fortybelow.ca>
Newsgroups comp.lang.javascript
Subject Re: Event Bubbling: Bubble, Bubble, Toil, and Trouble
Date 2012-04-05 20:57 -0600
Organization A noiseless patient Spider
Message-ID <jllm22$udd$1@dont-email.me> (permalink)
References <497sn7hj3iepoc4r9940di8l10ed8bvhl6@4ax.com>

Show all headers | View raw


On 12-04-05 04:36 PM, Gene Wirchenko wrote:
> I have added onfocus and onblur clauses to my page's<body>  tag,
> but the events rarely fire.  I have the event code add a line to the
> innerHTML of a debug out table element.
>
>       My debug output routine works fine.  The test messages get
> written.  The only control that the bubbling messages work on is the
> Quit button.  It does not work for any other buttons or any of the
> input controls.

Both the `onfocus`[0] and `onblur`[1] events do not bubble in
most environments. I'd advise against relying on that behavior.

However, both the `onfocusin`[2] and `onfocusout`[3] events have
been observed to bubble—though the corresponding MSDN
documentation says otherwise—in Internet Explorer. You may want
to consider those two events. I've provided a test[4]¹ that
confirms my suspicions.

Furthermore, setting the `innerHTML`[5] property in Internet
Explorer on an HTMLTableElement object will err. Doing so is
inadvisable. MSDN has offered up an alternative[6].

You have my apologies if I misinterpreted any portion of your
post. It was a bit vague.

[0]: http://msdn.microsoft.com/en-us/library/ms536934(v=vs.85).aspx
[1]: http://msdn.microsoft.com/en-us/library/ms536909(v=vs.85).aspx
[2]: http://msdn.microsoft.com/en-us/library/ms536935(v=vs.85).aspx
[3]: http://msdn.microsoft.com/en-us/library/ms536936(v=vs.85).aspx
[4]: http://www.fortybelow.ca/Code/JavaScript/Tests/FocusBlur/
[5]: http://msdn.microsoft.com/en-us/library/ms533897(v=vs.85).aspx
[6]: http://msdn.microsoft.com/en-us/library/ms532998(v=vs.85).aspx

¹ Test results as follows:

Linux Mint 12
Opera 11.62—pass;
Firefox 11—fail, no errors;
Chromium 18—fail, no errors.

Windows XP on VirtualBox (via Linux Mint)
Opera 5—fail, no errors;
Opera 6—fail, no errors;
Opera 7—fail, no errors;
Opera 8—fail, no errors;
Opera 9—fail, no errors;
Opera 10—fail, no errors;
Firefox 1—fail, no errors;
Firefox 2—fail, no errors;
Firefox 3—fail, no errors;
Safari 3.1—fail, no errors;
Internet Explorer 6—pass.

-- 
Matt McDonald: Web/Flash Developer; Edmonton, Alberta, Canada

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Event Bubbling: Bubble, Bubble, Toil, and Trouble Gene Wirchenko <genew@ocis.net> - 2012-04-05 15:36 -0700
  Re: Event Bubbling: Bubble, Bubble, Toil, and Trouble "Evertjan." <exjxw.hannivoort@interxnl.net> - 2012-04-05 22:50 +0000
  Re: Event Bubbling: Bubble, Bubble, Toil, and Trouble Matt McDonald <matt@fortybelow.ca> - 2012-04-05 20:57 -0600
    Re: Event Bubbling: Bubble, Bubble, Toil, and Trouble Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-04-06 22:22 +0200

csiph-web