Closed
Bug 658435
Opened 13 years ago
Closed 13 years ago
Javascript "InsertHere is not defined" error for body element
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
DUPLICATE
of bug 622491
People
(Reporter: larry-a-taylor, Unassigned)
Details
Attachments
(1 file)
(deleted),
text/plain
|
Details |
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
Build Identifier: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
Short example of how an element of a page body, such as a div with an id, cannot be accessed directly by a javascript script in FireFox, but works in IE, Safari, Chrome, both on Mac and Windows.
(GetElementbyId works OK in all, but is this necessary?
Reproducible: Always
Steps to Reproduce:
1.Open the page with javascript referring to an element directly. Example below.
2.
3.
Actual Results:
Error: InsertHere is not defined in Error Console. No text in document window
Expected Results:
Show show "This element is accessible.", having inserted the message via script.
function showMsg () {
InsertHere.innerHTML = "This element is accessible.";
}
<body onload="showMsg()">
<div id="InsertHere">
Reporter | ||
Comment 1•13 years ago
|
||
Load this in Firefox, then any other browser. Firefox 4.0.1 on both Mac and Windows tested, both 'bad'; Safari, IE, Google Chrome, all 'good'.
Reporter | ||
Comment 2•13 years ago
|
||
I did not see any duplicate of this bug, but there were many bug reports with "is not defined" that may be related. This seems to me to be the simplest possible case.
Comment 3•13 years ago
|
||
Reproduced.
Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.9.2.17) Gecko/20110420 Firefox/3.6.17
Mozilla/5.0 (X11; Linux x86_64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
Mozilla/5.0 (X11; Linux x86_64; rv:6.0a1) Gecko/20110519 Firefox/6.0a1
WFM:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.68 Safari/534.24
OS: Mac OS X → All
Hardware: x86 → All
Version: unspecified → Trunk
Comment 4•13 years ago
|
||
Your javascript is invalid. It should be:
document.getElementById("InsertHere").innerHTML
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago
Component: Developer Tools → DOM: Core & HTML
Product: Firefox → Core
QA Contact: developer.tools → general
Resolution: --- → INVALID
Version: Trunk → 2.0 Branch
Comment 5•13 years ago
|
||
FWIW, this would work in quirks mode, but not in standards mode. We don't intend to implement support in standards mode.
Resolution: INVALID → DUPLICATE
Comment 6•13 years ago
|
||
Actually, this is different from bug 602381. This bug is about bareword |foo| not resolving to an element with id="foo" in standards mode. That bug is about |window.foo| not resolving to an element with id="foo" in quirks mode.
They're very separate issue. We may well fix bug 602381 while not changing the standards mode behavior. We might well change the standards mode behavior while keeping the bareword vs fully qualified distinction.
Status: RESOLVED → REOPENED
Ever confirmed: true
Resolution: DUPLICATE → ---
Updated•13 years ago
|
Status: REOPENED → RESOLVED
Closed: 13 years ago → 13 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•