Ticket #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: | |
| Blocking: | Blocked by: |
Description
Same with $('input[value!=]').
Change History
comment:2 Changed 3 years ago by snover
- Priority changed from undecided to blocker
- Status changed from new to open
- Component changed from unfiled to event
comment:3 Changed 3 years ago by rwaldron
Any relation to http://bugs.jquery.com/ticket/7212 ?
comment:4 Changed 3 years ago by snover
- Status changed from open to closed
- Resolution set to duplicate
comment:6 Changed 3 years ago by Glen.84
Isn't #7243 a duplicate of this bug, since it was created after it?
comment:7 Changed 3 years ago by Glen.84
Please re-open ... http://jsfiddle.net/darkangel/geX3c/1/
comment:8 Changed 3 years ago by john
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 3 years ago by Glen.84
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 3 years ago by john
I've updated all the selector docs to represent this: http://api.jquery.com/category/selectors/attribute-selectors/
comment:11 Changed 3 years ago by Glen.84
"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 3 years ago by cowboy
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 3 years ago by anonymous
@cowboy (comment:12) I've changed the syntax errors in all attribute pages to match
jQuery('[attribute|="value"]')
comment:14 in reply to: ↑ 13 Changed 3 years ago by seankoole
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 3 years ago by kswedberg
- Status changed from closed to reopened
- Resolution duplicate deleted
- Component changed from event to selector
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 3 years ago by snover
- 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 3 years ago by john
- Owner set to john
- Status changed from reopened to 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 3 years ago by john
Think this might fix it, will try later:
.replace(/=\s*([^'"\]]*)\s*\]/g, "='$1'")
comment:19 Changed 3 years ago by John Resig
- Status changed from assigned to closed
- Resolution set to fixed
Ensure that unquoted attribute selectors are quoted (allowing them to go into qSA/matchesSelector properly). Fixes #7216.
Changeset: b0e1e83aa987279dcdb81112ec942c161111be17
comment:21 follow-up: ↓ 22 Changed 3 years ago by webmaster@…
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 in reply to: ↑ 21 Changed 3 years ago by jitter
Replying to webmaster@…:
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 3 years ago by webmaster@…
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:24 Changed 3 years ago by anonymous
Insignificant correction to test case.
comment:25 Changed 3 years ago by jitter
- Status changed from closed to reopened
- Version changed from 1.4.3 to 1.4.4
- Resolution fixed deleted
- Milestone changed from 1.4.4 to 1.4.5
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:27 Changed 3 years ago by christian.fazzini@…
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:29 Changed 2 years ago by john
- Status changed from open to closed
- Resolution set to fixed
The additional issues that were brought up here were taken care of in #6093.
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.


More detailed view: http://jsfiddle.net/seankoole/6EYxm/