#14236 closed bug (notabug)
Inconsistency with attributes selectors
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.10.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
There is a little inconsistency between Chrome and Firefox with attributes selectors
For the two following examples, chrome could run it, but firefox not:
$('a[rel=nofollow]').on('click', function(event) { ... });
$('a[rel=nofollow"]').on('click', function(event) { ... });
Firefox stopped the script with error about unrecognized expression.
Finally what worked for both was
$("a[rel='nofollow']").on('click', function(event) { ... });
Change History (2)
comment:1 Changed 10 years ago by
Resolution: | → notabug |
---|---|
Status: | new → closed |
comment:2 Changed 10 years ago by
If it's a bare identifier the quotes are optional. But you can't ever half-quote, which seems to be the problem in at least one of them. There's not enough information in the code snippet to know what "could run it" means so it would be best to ask for help on a forum.
Note: See
TracTickets for help on using
tickets.
Yes, quotes are required. Says so in the docs: http://api.jquery.com/category/selectors/attribute-selectors/