Closed
Bug 545209
Opened 15 years ago
Closed 14 years ago
Can't get OBJECT via ID if the html-object is an input of the type hidden.
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
VERIFIED
WORKSFORME
People
(Reporter: berstbest, Unassigned)
Details
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.7) Gecko/20091221 Firefox/3.0.8 (en-US) (.NET CLR 3.5.30729)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.7) Gecko/20091221 Firefox/3.0.8 (en-US) (.NET CLR 3.5.30729)
While testing with some HTML and JavaScript I found that in Firefox an input-field of the type hidden as defined like this:
<input type="hidden" id="h1" value="foo" />
can not be found with Javascript by a call like this:
alert(document.getElementById('h1')); //returns null
This only happens if on the html-site all inputs are of the type hidden!
Reproducible: Always
Steps to Reproduce:
1. Create a html-site with the following simple code (it may not be valid but it will suffice the bug-reproducing):
<input type="hidden" id="a1" value="a1" />
<input type="text" id="a2" value="a2" />
<script type=text/javascript>
alert(document.getElementById('a1'));
alert(document.getElementById('a2'));
</script>
This should get you 2 alert-Messages with each one saying: [object HTMLInputElement]
2. Now create a second HTML-file with the following code:
<input type="hidden" id="a1" value="a1" />
<input type="hidden" id="a2" value="a2" />
<script type=text/javascript>
alert(document.getElementById('a1'));
alert(document.getElementById('a2'));
</script>
As you can see we have only changed the type of the second input from text to hidden.
Now the result will be 2 alert-Messages with each one saying: null
Actual Results:
The getElementById() function returns null which means that the Objects were not found, which should not have happend as they both exist.
Expected Results:
As in the first example the script should have replied with [object HTMLInputElement] not with null.
Comment 1•14 years ago
|
||
Can confirm on 3.6 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13 ID:20101203075014
However, this works on trunk - Mozilla/5.0 (Windows NT 5.1; rv:2.0b9pre) Gecko/20101222 Firefox/4.0b9pre ID:20101222030351
Updated•14 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
Comment 2•14 years ago
|
||
Reporter -> Can you retest with Firefox 6 and report if the issue persists?
Retestet the mentioned Bug and could not find any problems with
Mozilla/5.0 (X11; Linux i686; rv:6.0) Gecko/20100101 Firefox/6.0
I therefor closed this Bug.
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → INVALID
Comment 4•14 years ago
|
||
Thanks. Happy to see it works for you!
Status: RESOLVED → VERIFIED
Component: General → DOM
Product: Firefox → Core
QA Contact: general → general
Resolution: INVALID → WORKSFORME
Version: 3.6 Branch → 1.9.2 Branch
Assignee | ||
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•