Side navigation
#14236 closed bug (notabug)
Opened August 08, 2013 10:55PM UTC
Closed August 08, 2013 11:06PM UTC
Last modified August 09, 2013 12:27AM UTC
Inconsistency with attributes selectors
Reported by: | rellect@gmail.com | 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) { ... });
Attachments (0)
Change History (2)
Changed August 08, 2013 11:06PM UTC by comment:1
resolution: | → notabug |
---|---|
status: | new → closed |
Changed August 09, 2013 12:27AM UTC by comment:2
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.
Yes, quotes are required. Says so in the docs: http://api.jquery.com/category/selectors/attribute-selectors/