Closed
Bug 1267356
Opened 10 years ago
Closed 10 years ago
hidden property associated to HTMLElement is not working as expected
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: devan.shah14, Unassigned)
Details
Attachments
(1 file)
|
425 bytes,
text/html
|
Details |
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0
Build ID: 20160411140819
Steps to reproduce:
Running Javascript "document.getElementById("formHiddenSomeHow").hidden" on one of the elements on my page, this form element contains an element under it which has id="hidden". Attached is a sample webpage.
Actual results:
When I execute the above javascript on this page it is not returning a boolean but instead it is returning my element which has the id="hidden". (In the case I have multiple elements which have hidden id, it returns a Radio list of those elements.
Expected results:
I expected it to return a boolean true or false if the element is hidden or not, which is what the https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement specs say that the HTMLElement.hidden is to be used for.
| Reporter | ||
Updated•10 years ago
|
Product: Firefox → Core
| Reporter | ||
Updated•10 years ago
|
Component: Untriaged → DOM
| Reporter | ||
Updated•10 years ago
|
Severity: normal → major
Comment 1•10 years ago
|
||
I'm afraid <https://html.spec.whatwg.org/multipage/#the-form-element> shows that the HTMLFormElement interface has the OverrideBuiltins extended attribute, which implies this behaviour: <http://heycam.github.io/webidl/#OverrideBuiltins>.
INVALID per spec; you could try to get the spec changed, though I doubt you'd succeed.
Status: UNCONFIRMED → RESOLVED
Closed: 10 years ago
Resolution: --- → INVALID
| Reporter | ||
Comment 2•10 years ago
|
||
The same issue exists even if you change the parent from form element to div element and according to https://html.spec.whatwg.org/multipage/semantics.html#the-div-element div does not have the OverrideBuiltins.
But why would the OverrideBuiltins affect id="hidden" context, hidden in this case is only being used as a string context and nothing else.
Flags: needinfo?(Ms2ger)
| Reporter | ||
Comment 3•10 years ago
|
||
ignore the previous comment, it does not happen for div, only happens for div if there is a form element embedded under div
Flags: needinfo?(Ms2ger)
| Reporter | ||
Comment 4•10 years ago
|
||
But in general why would id="hidden" OverrideBuiltins override the FormElement.hidden, to return that element instead of boolean. In this context hidden is a string context and nothing more. or is that not the case.
So in the case that I have something like the following:
<form hidden id="formHiddenSomeHow">
<input id="hidden">
</form>
My form is hidden but when i do document.getElementById("formHiddenSomeHow").hidden it does not return if it is hidden or not. I can check it as an attribute, but in the case that the hidden is added with javascript it will not show up as attribute.
Flags: needinfo?(Ms2ger)
Comment 5•10 years ago
|
||
form elements have a getter that exposes elements by ID as properties on the element: https://html.spec.whatwg.org/multipage/forms.html#dom-form-nameditem
Flags: needinfo?(Ms2ger)
| Reporter | ||
Comment 6•10 years ago
|
||
thanks
| Assignee | ||
Updated•7 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•