Side navigation
#11923 closed bug (fixed)
Opened June 18, 2012 01:35AM UTC
Closed June 23, 2012 11:38PM UTC
.removeClass() should remove all occurrences of class name
| Reported by: | davidchambers | Owned by: | rwaldron |
|---|---|---|---|
| Priority: | low | Milestone: | None |
| Component: | attributes | Version: | 1.7.2 |
| Keywords: | Cc: | ||
| Blocked by: | Blocking: |
Description
This behaviour is erroneous in my view:
> $('<b class="x x">').removeClass('x').hasClass('x')
true
Attachments (0)
Change History (4)
Changed June 23, 2012 01:49PM UTC by comment:1
| component: | unfiled → attributes |
|---|---|
| priority: | undecided → low |
| status: | new → open |
Changed June 23, 2012 03:45PM UTC by comment:2
| owner: | → rwaldron |
|---|---|
| status: | open → assigned |
Changed June 23, 2012 06:06PM UTC by comment:3
@dmethvin: Sure, I'm just keen to avoid *ever* having to write:
while ($el.hasClass('x')) $el.removeClass('x')
http://jsfiddle.net/yCGZj/
Yeah we should either document this or change the behavior. Note that
.addClass()won't create duplicates, so the only way to get into this situation is with a class string that has dups in the first place.