Side navigation
#6050 closed bug (fixed)
Opened February 07, 2010 05:20PM UTC
Closed February 13, 2010 07:18AM UTC
jQuery 1.4.1 addClass white space issue
Reported by: | slawek | Owned by: | john |
---|---|---|---|
Priority: | Milestone: | 1.4.2 | |
Component: | attributes | Version: | 1.4.1 |
Keywords: | addClass | Cc: | |
Blocked by: | Blocking: |
Description
When working with elements having single class name I've noticed something weird.
Example.
<div id="head" class="head"></div>
$('#head').removeClass('head');
<div id="head" class=" "></div>
$('#head').addClass('head');
<div id="head" class=" head"></div>
So there's no way to compare element class name against some value let's say
if ($('#head').attr('class') == 'head') { ...
because the name of elemnt class is ' head' not 'head'
won't work for version 1.4.1 but it works OK for 1.3.2