Skip to main content

Bug Tracker

Side navigation

#7216 closed bug (fixed)

Opened October 16, 2010 07:31PM UTC

Closed January 17, 2011 10:46PM UTC

Last modified March 10, 2012 12:00AM UTC

[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

http://jsfiddle.net/9QjJD/4/

Same with $('input[value!=]').

Attachments (0)
Change History (29)

Changed October 16, 2010 07:34PM UTC by seankoole comment:1

Changed October 16, 2010 08:13PM UTC by snover comment:2

component: unfiledevent
priority: undecidedblocker
status: newopen

Changed October 19, 2010 03:47AM UTC by rwaldron comment:3

Changed October 20, 2010 07:03AM UTC by snover comment:4

resolution: → duplicate
status: openclosed

Changed October 20, 2010 07:03AM UTC by snover comment:5

Duplicate of #7243.

Changed October 20, 2010 08:44AM UTC by Glen.84 comment:6

Isn't #7243 a duplicate of this bug, since it was created after it?

Changed October 24, 2010 05:44PM UTC by Glen.84 comment:7

Changed October 25, 2010 07:33PM UTC by john comment:8

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/

Changed October 25, 2010 07:44PM UTC by Glen.84 comment:9

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.

Changed October 25, 2010 08:03PM UTC by john comment:10

I've updated all the selector docs to represent this:

http://api.jquery.com/category/selectors/attribute-selectors/

Changed October 26, 2010 08:04PM UTC by Glen.84 comment:11

"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."

Changed October 31, 2010 02:35PM UTC by cowboy comment:12

_comment0: The docs are now somewhat confusing, as they suggest doing something syntactically impossible: `jQuery('[attribute|='value']')`. \ \ [[Image(http://gyazo.com/d29d38d82859a4c574cb96fe19cd9ff6.png)]] \ \ All the attribute selector "name" values should combine single/double quotes and either be `jQuery("[attribute|='value']")` or `jQuery('[attribute|="value"]')`, whichever is more universally consistent.1288535803677978

The docs are now somewhat confusing, as they suggest doing something syntactically impossible: jQuery('[attribute|='value']').

[[Image(http://gyazo.com/d29d38d82859a4c574cb96fe19cd9ff6.png)]]

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.

Changed October 31, 2010 04:09PM UTC by anonymous comment:13

@cowboy (comment:12)

I've changed the syntax errors in all attribute pages to match

jQuery('[attribute|="value"]')

Changed October 31, 2010 04:10PM UTC by seankoole comment:14

Replying to [comment:13 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 :)

Changed November 07, 2010 12:31AM UTC by kswedberg comment:15

component: eventselector
resolution: duplicate
status: closedreopened

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.

Changed November 07, 2010 02:09AM UTC by snover comment:16

keywords: → regression needsreview

Quotes are optional only if the value part is an ident. This is detailed in the css3 grammar.

Changed November 08, 2010 10:52PM UTC by john comment:17

owner: → john
status: reopenedassigned

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.

Changed November 08, 2010 11:00PM UTC by john comment:18

_comment0: Think this might fix it, will try later: \ {{{ \ .replace(/=\\s*([^'"]*)\\s*\\]/g, "='$1'") \ }}}1289257256375806

Think this might fix it, will try later:

.replace(/=\\s*([^'"\\]]*)\\s*\\]/g, "='$1'")

Changed November 09, 2010 07:03PM UTC by John Resig comment:19

resolution: → fixed
status: assignedclosed

Ensure that unquoted attribute selectors are quoted (allowing them to go into qSA/matchesSelector properly). Fixes #7216.

Changeset: b0e1e83aa987279dcdb81112ec942c161111be17

Changed November 10, 2010 08:17PM UTC by ajpiano comment:20

keywords: regression needsreviewregression

Changed November 19, 2010 06:44AM UTC by webmaster@thedigitalorchard.ca comment:21

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.

Changed November 19, 2010 08:03PM UTC by jitter comment:22

Replying to [comment:21 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.

Changed November 21, 2010 08:44AM UTC by webmaster@thedigitalorchard.ca comment:23

Reduced test case.

http://jsfiddle.net/2KPBQ/

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

Changed November 21, 2010 08:46AM UTC by anonymous comment:24

Insignificant correction to test case.

http://jsfiddle.net/2KPBQ/1/

Changed November 21, 2010 10:12PM UTC by jitter comment:25

milestone: 1.4.41.4.5
resolution: fixed
status: closedreopened
version: 1.4.31.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)

Changed November 21, 2010 10:13PM UTC by jitter comment:26

status: reopenedopen

Changed December 09, 2010 12:12PM UTC by christian.fazzini@gmail.com comment:27

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?

Changed January 17, 2011 06:50PM UTC by dmethvin comment:28

milestone: 1.4.51.5

Changed January 17, 2011 10:46PM UTC by john comment:29

resolution: → fixed
status: openclosed

The additional issues that were brought up here were taken care of in #6093.