Skip to main content

Bug Tracker

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

Attachments (0)
Change History (3)

Changed February 08, 2010 04:35PM UTC by john comment:1

milestone: 1.4.11.4.2
owner: → john
status: newassigned

Changed February 12, 2010 11:47PM UTC by Leeoniya comment:2

Changed February 13, 2010 07:18AM UTC by john comment:3

resolution: → fixed
status: assignedclosed