hidden property associated to HTMLElement is not working as expected

RESOLVED INVALID

Status

()

Core
DOM
--
major
RESOLVED INVALID
2 years ago
2 years ago

People

(Reporter: devan.shah14, Unassigned)

Tracking

45 Branch
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

2 years ago
Created attachment 8745010 [details]
hiddenPropertyPickingUpSomethingElse.html

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

2 years ago
Component: Untriaged → Untriaged
Product: Firefox → Core
(Reporter)

Updated

2 years ago
Component: Untriaged → DOM
(Reporter)

Updated

2 years ago
Severity: normal → major
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
Last Resolved: 2 years ago
Resolution: --- → INVALID
(Reporter)

Comment 2

2 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

2 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

2 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)
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

2 years ago
thanks
You need to log in before you can comment on or make changes to this bug.