Side navigation
#8164 closed bug (duplicate)
Opened February 03, 2011 04:12PM UTC
Closed February 03, 2011 06:10PM UTC
Last modified March 13, 2012 04:00PM UTC
Inconsistent results when selecting "number" type inputs
Reported by: | patrickwhalen | Owned by: | |
---|---|---|---|
Priority: | high | Milestone: | 1.next |
Component: | misc | Version: | 1.5 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
I don't know if this is intended to be supported, but "number" inputs are sometimes not selected when using [type="number"]
.
Given this HTML:
#!xml <input type="number"> <!-- number input -->
This selector selects the input:
#!js $('input[type="number"]')
But this one (using the :input
pseudo selector) does not:
#!js $(':input[type="number"]')
Verified in Firefox 3.6 on Mac.
Works in Chrome 9 beta on Mac, but received reports that Chrome 8 experienced the same problem.
**Test Case:** http://jsfiddle.net/eMENG/2/
Attachments (0)
Change History (8)
Changed February 03, 2011 04:46PM UTC by comment:1
resolution: | → duplicate |
---|---|
status: | new → closed |
Changed February 03, 2011 06:00PM UTC by comment:3
_comment0: | Replying to [comment:1 addyosmani]: \ > ...please note that (to the best of my knowledge) there are no valid types based on numbers for this particular case eg. <input type=5>. I would argue that <input type="5"> should also be invalid... \ \ I'm not referring to a numeric value. I'm referring to the HTML5 "number" type element, which provides increment/decrement buttons. I assume jQuery will want to support this input type at some point. \ \ http://www.w3.org/html/wiki/Elements/input/number → 1296756363426934 |
---|---|
_comment1: | Replying to [comment:1 addyosmani]: \ > ...please note that (to the best of my knowledge) there are no valid types based on numbers for this particular case eg. <input type=5>. I would argue that <input type="5"> should also be invalid... \ \ I'm not referring to a numeric value. I'm referring to the HTML5 "number" type element, which provides increment/decrement buttons. I assume jQuery will want to support this input type at some point. \ \ http://www.w3.org/html/wiki/Elements/input/number \ \ **EDIT: Forget that last sentence above the link. Where "number" types are supported, qsa will also be supported.** → 1296756403755132 |
_comment2: | Replying to [comment:1 addyosmani]: \ > ...please note that (to the best of my knowledge) there are no valid types based on numbers for this particular case eg. <input type=5>. I would argue that <input type="5"> should also be invalid... \ \ I'm not referring to a numeric value. I'm referring to the HTML5 "number" type element, which provides increment/decrement buttons. I assume jQuery will want to support this input type at some point. \ \ http://www.w3.org/html/wiki/Elements/input/number \ → 1296756450180528 |
Replying to [comment:1 addyosmani]:
...please note that (to the best of my knowledge) there are no valid types based on numbers for this particular case eg. <input type=5>. I would argue that <input type="5"> should also be invalid...
I'm not referring to a numeric value. I'm referring to the HTML5 "number" type element, which provides increment/decrement buttons. I assume jQuery/Sizzle will want to support this input type at some point.
Changed February 03, 2011 06:10PM UTC by comment:4
resolution: | duplicate |
---|---|
status: | closed → reopened |
Changed February 03, 2011 06:10PM UTC by comment:5
component: | unfiled → misc |
---|---|
priority: | undecided → high |
resolution: | → duplicate |
status: | reopened → closed |
Changed February 03, 2011 07:19PM UTC by comment:7
Same root cause as #8663 and #8039, a combination of HTML5 and Sizzle incompatibilities. input[type="number"]
is a valid standard CSS selector and goes through the browser's querySelectorAll implementation. :input[type="number"]
is a jQuery selector extension so it goes through Sizzle's Javascript selector engine. In Sizzle we look at the type property, not the type attribute, and the property is "text" for unrecognized attributes like "number".
Changed February 17, 2011 11:38AM UTC by comment:8
More accurately, this bug is a dupe of #8039 -- the fix already exists there to bring the Sizzle implementation closer to that of the qSA for the
typeattribute... The browser normalizes the
typeproperty to
'text'for any unsupported input types, which is why Sizzles implementation currently fails to produce the same results as the qSA
Closing as a duplicate of your other ticket (#8163). Even if there's a difference between text and numeric input, because you're using them in the context of a string in your query where both this ticket and the other are essentially attempting to do the same thing, we're going to end up having similar resolutions on them. Also, please note that (to the best of my knowledge) there are no valid types based on numbers for this particular case eg. <input type=5>. I would argue that <input type="5"> should also be invalid, but we'll discuss how jQuery will handle these cases on 8163.