Opened 14 years ago
Closed 12 years ago
#4817 closed bug (fixed)
hasClass expands selector metacharacters
Reported by: | sixtease | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | 1.4.2 |
Component: | attributes | Version: | 1.3.2 |
Keywords: | selector, hasClass, class, metacharacter, needsreview | Cc: | |
Blocked by: | Blocking: |
Description
hasClass method doesn't recognize classes with dots and other metacharacters. They must be escaped.
<div id="dotclass" class="has.dot"></div> <script> if ( $('#dotclass').hasClass('has.dot') ) alert('works'); else alert('fails'); if ( $('#dotclass').hasClass('has\\.dot') ) alert('works with \\\\'); </script>
Attachments (2)
Change History (4)
Changed 14 years ago by
Attachment: | jquery-hasClass.diff added |
---|
comment:1 Changed 12 years ago by
Keywords: | needsreview added |
---|
Your test case works fine using both the standard '.' form and a single forward-slash. Given that a well-named class shouldn't contain multiple meta-characters (eg.
\) in the first place, I want to flag this as an edge-case that probably will not be experienced by a large number of users. Leaving it open for now.
comment:2 Changed 12 years ago by
Component: | core → attributes |
---|---|
Milestone: | 1.4 → 1.4.2 |
Priority: | minor → low |
Resolution: | → fixed |
Status: | new → closed |
test case was fixed with 1.4.2.
If the bug still exists for you, feel free to reopen with a test case.
Note: See
TracTickets for help on using
tickets.
patch