Closed
Bug 246309
Opened 21 years ago
Closed 21 years ago
[label object].GetAttribute('htmlFor') returns null
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
VERIFIED
INVALID
People
(Reporter: md, Unassigned)
Details
Attachments
(2 files)
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7b) Gecko/20040316
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7b) Gecko/20040316
html code:
<label for="foo">Label Text</label>
The W3C DOM states that the 'for' attribute should be 'htmlFor' in the DOM.
This is to avoid conflict with the javascript keyword 'for'.
JAVASCRIPT CODE:
var x = labelElement.GetAttribute('htmlFor');
EXPECTED:
x should be the 'for' attribute of the labelElement object.
RESULTS:
x is null.
Note: labelElement.GetAttribute('for') does return the 'for' attribute - in fact
this return null.
Reproducible: Always
Steps to Reproduce:
1. Open up testcase1.html (attached)
2. Click through the input elements
Expected Results:
The relevent label should be highlighted.
This bug is also present in Firefox 0.8 under Windows XP.
Reporter | ||
Comment 1•21 years ago
|
||
Testcase1 shows sample code using getAttribute('htmlFor')
Reporter | ||
Comment 2•21 years ago
|
||
Testcase2 shows sample code using getAttribute('for').
This 'for' attribute is invalid (according to the W3C DOM) and therefore, the
code should not work.
Comment 3•21 years ago
|
||
That section in the DOM rec is about property attributes (see section 1.6.1),
HTML attributes exposed as properties on their elements. Try element.htmlFor.
Status: UNCONFIRMED → RESOLVED
Closed: 21 years ago
Resolution: --- → INVALID
Updated•14 years ago
|
Assignee: general → nobody
Status: RESOLVED → VERIFIED
OS: Windows XP → All
Hardware: x86 → All
You need to log in
before you can comment on or make changes to this bug.
Description
•