Closed Bug 326913 Opened 20 years ago Closed 16 years ago

"body onFocus" should not be supported, it's not in the HTML specs

Categories

(Core :: DOM: Core & HTML, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: cyberman, Unassigned)

Details

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; de; rv:1.8) Gecko/20051111 Firefox/1.5 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; de; rv:1.8) Gecko/20051111 Firefox/1.5 Contrary to the W3C HTML (4.01) specification, "body onFocus" is supported - this can be used to create an infinite loop by using " body onFocus="alert('Loop')" ". As soon as the alert box pops up, body loses focus - when you click the box away, body regains focus => box pops up. Reproducible: Always Steps to Reproduce: 1.Create a simple HTML file with "body onFocus="alert('Loop')" " 2.Run that file 3.Try to close it(file or box). Actual Results: An alert box pops up, upon clicking it away, it comes again. Expected Results: Nothing. "onFocus" is not supposed to work with "body". Only "A, AREA, LABEL, INPUT, SELECT, TEXTAREA, and BUTTON" are supposed to work with "onFocus". There seem to be several bugs that also address this - none (that I found) refer to this exclusively, though. Perhaps this is intended behavior to imitate older browsers? I tried it with HTML 4.01, and XHTMl 1.0 - same result.
Related to/duplicate of Core bug 80786 -> Core bug 58441 and/or bug 302787 -> Core bug 253239?
(In reply to comment #1) > Related to/duplicate of Core bug 80786 -> Core bug 58441 and/or bug 302787 -> > Core bug 253239? > 253239 has no relation to this bug, aside from using JavaScript and "alert". Related to 58411, not a duplicate. The symptoms of 58411 are similar to this here, it's basically the same situation, but in this case the "onFocus" shouldn't even be processed.
I'm pretty sure this is invalid. Mozilla does support onfocus for all elements (as long as they can receive focus). In general, for normal html documents <body onfocus> means that the window of that document gets focus. This is part of the so-called DOM level 0 (which is all the DOM stuff that hasn't been specified).
Component: General → DOM: Level 0
Product: Firefox → Core
QA Contact: general → general
The unresponsiveness is covered by other bugs, so I'm making this bug just be about whether we support body onfocus.
Summary: "body onFocus" should not be supported, it's not in the HTML specs. Can cause infinite loops and/or crashes. → "body onFocus" should not be supported, it's not in the HTML specs
As HTML5 defines body onfocus, I'm marking this bug as invalid. See <http://www.whatwg.org/html5/#the-body-element-0>.
Status: UNCONFIRMED → RESOLVED
Closed: 16 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.