Bug 7161 - getElementById doesn't work as expected in IFrame onload handler
Summary: getElementById doesn't work as expected in IFrame onload handler
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 420+
Hardware: Mac OS X 10.4
: P2 Normal
Assignee: Nobody
URL:
Keywords: HasReduction
Depends on:
Blocks:
 
Reported: 2006-02-09 11:30 PST by Alexey Proskuryakov
Modified: 2009-02-20 00:37 PST (History)
2 users (show)

See Also:


Attachments
test case (513 bytes, text/html)
2006-02-09 11:31 PST, Alexey Proskuryakov
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexey Proskuryakov 2006-02-09 11:30:32 PST
See the attached test case (which works as expected in Firefox and WinIE).

The document body has an element:
<p id=console>FAILURE</p>

For whatever reason, document.getElementById("console") returns null if called from an IFrame onload handler.
Comment 1 Alexey Proskuryakov 2006-02-09 11:31:07 PST
Created attachment 6367 [details]
test case
Comment 2 Alexey Proskuryakov 2006-02-09 11:45:19 PST
Starts to work if the iframe is moved below <p>.

"onclick handler" in the alert was supposed to be "onload handler", of course. It is there to indicate that the handler is called at all (didn't fire before, bug 3609).