Closed Bug 495217 Opened 15 years ago Closed 15 years ago

Firefox 3.5 querySelectorAll considers hidden input elements when using the :enabled and :disabled pseudo-class


(Core :: DOM: Core & HTML, defect)

Not set





(Reporter: diego.perini, Unassigned)




User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; it; rv:1.9.1b4) Gecko/20090423 Firefox/3.5b4
Build Identifier: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; it; rv:1.9.1b4) Gecko/20090423 Firefox/3.5b4

Try this small URL snippet on "":


In Firefox 3.5b4 the result is 6 while in Safari 4b the result is 2.

There are 4 hidden input elements and 2 text input element on that page.

Thus, FF 3.5b4 considers hidden elements part of the result set, while Safari 4b does not consider them as such. This seems in line with latest CSS Level 3 Selectors specifications while Safari seems to match the new HTML 5 selectors specifications.

Related specifications:

So having different implementations in current browsers will create confusion for authors and code written for them.

This bug have been submitted to webkit with ticket #25720, the description of the bug there is different (contrary) from this since the two browsers seems to follow different specification drafts.

Reproducible: Always

Steps to Reproduce:
1. Go to
2. Type URL javascript:alert(document.querySelectorAll('input:enabled').length)
3. In FF 3.5b4 should alert 6 in Safari 4b should alert 2
Actual Results:  
Different results in FF3.5b4 and Safari 4b.

Expected Results:  
Different results expected by different draft specs CSS3/HTML5, not sure which is the one to be followed. I expected the same results in both browsers.

Not sure, though I see some advantages in implementing the HTML 5 specs.

The reason are that "hidden" fields could be "disabled" by author with the objective/intention of not submitting specific hidden fields. Then by using an ":enabled" query on a specific form we could easily serialize their submitted fields, and have "disabled" fields automatically excluded.

This is the current behavior for "disabled" form elements (not submitted).

Another plus for HTML5 specs is that we could save authors from writing code that would turn "hidden" form elements into "visible" elements by means of wrong CSS skinning rules.
Component: General → DOM
Product: Firefox → Core
QA Contact: general → general
Closed: 15 years ago
Resolution: --- → DUPLICATE
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.