#8120 closed bug (invalid)
Attribute selectors now require quotations
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | low | Milestone: | 1.next |
Component: | selector | Version: | 1.5 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
It appears that some attribute selectors now require quoting around their values. Failure to do so will throw the following error:
"Syntax error, unrecognized expression: {selector}".
Strangely, this fails with the following piece of code:
$("a[href^=/shortlist/]");
requiring a change to
$("a[href^='/shortlist/']");
but not when using:
$("a[href=#]");
I know this isn't a bug, and that now I check it in fact mentions in the documentation that quotes are mandatory, but it should probably be added as a warning into the release notes, or wherever is appropriate, as it is a change from 1.4.4 that will cause upgrade issues for some.
Change History (4)
comment:1 Changed 12 years ago by
Component: | unfiled → selector |
---|---|
Keywords: | needsdocs added |
Priority: | undecided → high |
Status: | new → open |
comment:2 Changed 12 years ago by
Keywords: | needsdocs removed |
---|---|
Priority: | high → low |
Resolution: | → invalid |
Status: | open → closed |
Note: See
TracTickets for help on using
tickets.
Thanks for taking the time to contribute to the jQuery project by writing a bug report.
After checking your report I came to the conclusion that this isn't a bug. Actually the behavior in jQuery 1.4.4 was wrong and has been fixed in 1.5
a[href^=/shortlist/]
isn't a valid CSS selector which you can easily verify with this test caseBeside the documentation explicitly stating that "quotes are mandatory" also the selectors documentation warns you with
This list includes the
/
character.