#7216 closed bug (fixed)
[Regression] $('input[value=]').live('change', ...) does not work in 1.4.3 (FF 3.6.10)
Reported by: | Glen.84 | Owned by: | john |
---|---|---|---|
Priority: | blocker | Milestone: | 1.5 |
Component: | selector | Version: | 1.4.4 |
Keywords: | regression | Cc: | |
Blocked by: | Blocking: |
Description
Same with $('input[value!=]').
Change History (29)
comment:1 Changed 12 years ago by
comment:2 Changed 12 years ago by
Component: | unfiled → event |
---|---|
Priority: | undecided → blocker |
Status: | new → open |
comment:4 Changed 12 years ago by
Resolution: | → duplicate |
---|---|
Status: | open → closed |
comment:6 Changed 12 years ago by
Isn't #7243 a duplicate of this bug, since it was created after it?
comment:8 Changed 12 years ago by
Isn't that an invalid selector? You can't do !=] or =] - you have to have quotes. Changing that makes it work: http://jsfiddle.net/geX3c/2/
comment:9 Changed 12 years ago by
As mentioned on IRC, it worked in 1.4.2 and the documentation says the quotes are optional.
The documentation should be updated if the selector is invalid.
Thanks.
comment:10 Changed 12 years ago by
I've updated all the selector docs to represent this: http://api.jquery.com/category/selectors/attribute-selectors/
comment:11 Changed 12 years ago by
"Attribute values in selector expressions can be written as bare words and must be surrounded by quotation marks."
Shouldn't that be *cannot* be written as bare words? Or simply ...
"Attribute values in selector expressions must be surrounded by quotation marks."
comment:12 Changed 12 years ago by
The docs are now somewhat confusing, as they suggest doing something syntactically impossible: jQuery('[attribute|='value']')
.
All the attribute selector "name" values should combine single/double quotes and be formatted as either jQuery("[attribute|='value']")
or jQuery('[attribute|="value"]')
, whichever is more universally consistent.
comment:13 follow-up: 14 Changed 12 years ago by
@cowboy (comment:12) I've changed the syntax errors in all attribute pages to match
jQuery('[attribute|="value"]')
comment:14 Changed 12 years ago by
Replying to anonymous:
@cowboy (comment:12) I've changed the syntax errors in all attribute pages to match
jQuery('[attribute|="value"]')
Wasn't logged in, but that was me :)
comment:15 Changed 12 years ago by
Component: | event → selector |
---|---|
Resolution: | duplicate |
Status: | closed → reopened |
Changing the docs isn't a sufficient fix for this problem, especially for a 1.x.x release, since it potentially breaks a lot of existing code. Additionally, examples in the CSS spec suggest that quotes are optional: http://www.w3.org/TR/CSS2/selector.html#attribute-selectors
This bug was closed as duplicate of #7243, but they're really two separate issues.
comment:16 Changed 12 years ago by
Keywords: | regression needsreview added |
---|
Quotes are optional only if the value part is an ident. This is detailed in the css3 grammar.
comment:17 Changed 12 years ago by
Owner: | set to john |
---|---|
Status: | reopened → assigned |
Ok, Karl provided another test case: http://jsfiddle.net/XEAuc/1/
This is more than when there's no content on the right hand side. I'll look into this.
comment:18 Changed 12 years ago by
Think this might fix it, will try later:
.replace(/=\s*([^'"]*)\s*\]/g, "='$1'")
comment:19 Changed 12 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Ensure that unquoted attribute selectors are quoted (allowing them to go into qSA/matchesSelector properly). Fixes #7216.
Changeset: b0e1e83aa987279dcdb81112ec942c161111be17
comment:20 Changed 12 years ago by
Keywords: | needsreview removed |
---|
comment:21 follow-up: 22 Changed 12 years ago by
This "bug fix" doesn't seem to work correctly in all cases. Refer to the example on the Selectors page of the Documentation for a simple example that doesn't work with jQuery 1.4.4.
http://api.jquery.com/category/selectors/ (example in second paragraph... try to run this code in jQuery 1.4.4)
It seems that the modification made by this bug fix in the Sizzle function seems to choke on some of the meta-characters that are supposed to be allowed in selectors. In particular, some of my selectors contain the "=" character in an attribute, but the quoting logic doesn't seem to handle this case properly.
comment:22 Changed 12 years ago by
Replying to [email protected]…:
This "bug fix" doesn't seem to work correctly in all cases.
It seems that the modification made by this bug fix in the Sizzle function seems to choke on some of the meta-characters that are supposed to be allowed in selectors. In particular, some of my selectors contain the "=" character in an attribute, but the quoting logic doesn't seem to handle this case properly.
Please submit a reduced test case which reproduces the issue you are experiencing (ideally on http://jsfiddle.net). So that we can investigate this issue further.
comment:23 Changed 12 years ago by
Reduced test case.
Under 1.4.3 and 1.4.4, it doesn't work, but does under 1.4.2. (Maybe the issue was introduced in 1.4.3, but I didn't notice).
comment:25 Changed 12 years ago by
Milestone: | 1.4.4 → 1.4.5 |
---|---|
Resolution: | fixed |
Status: | closed → reopened |
Version: | 1.4.3 → 1.4.4 |
test case which works under jQuery 1.4.2/1.4.3 but fails under 1.4.4
The testcase provided in comment 23/24 also work in 1.4.2/1.4.3 but fail under 1.4.4 (Opera 10.63 and FF 3.6.12 tested)
comment:26 Changed 12 years ago by
Status: | reopened → open |
---|
comment:27 Changed 12 years ago by
Additionally,
$("input[name=song[attachment]]").length returns 0
$("input[name='song[attachment]']").length returns 1
The first case used to work in 1.4.2 and is not working on 1.4.4. Is this being looked at as well?
comment:28 Changed 12 years ago by
Milestone: | 1.4.5 → 1.5 |
---|
comment:29 Changed 12 years ago by
Resolution: | → fixed |
---|---|
Status: | open → closed |
The additional issues that were brought up here were taken care of in #6093.
More detailed view: http://jsfiddle.net/seankoole/6EYxm/