Skip to main content

Bug Tracker

Side navigation

#10136 closed bug (duplicate)

Opened August 25, 2011 03:03PM UTC

Closed August 25, 2011 03:59PM UTC

Last modified August 26, 2011 11:31AM UTC

.removeAttr has problems in chrome

Reported by: anonymous Owned by:
Priority: high Milestone: None
Component: attributes Version: 1.6.2
Keywords: Cc:
Blocked by: Blocking:
Description

When executing this code http://jsfiddle.net/pjabT/ which contains

<ul>

<li id="a">

<p>In Chrome this text will turn red and stay red. Why?</p>

<span id="s" style="">Text</span>

</li>

</ul>

for the HTML

and

var t = true;

setInterval(function(){

t = !t;

if(t){

$('#s').css('color','rgb(255, 0, 0)');

} else {

$('#s').removeAttr('style');

}

}, 1000);

for the Javascript Chrome will not remove the style attribute or reset it. Works with FF and IE.

Attachments (0)
Change History (3)

Changed August 25, 2011 03:59PM UTC by timmywil comment:1

component: unfiledattributes
priority: undecidedhigh
resolution: → duplicate
status: newclosed

Changed August 25, 2011 03:59PM UTC by timmywil comment:2

Duplicate of #9699.

Changed August 26, 2011 11:31AM UTC by cdesguez comment:3

I can reproduce this in Chromium 12.0.742.112 (90304) for Ubuntu 10.04

This is true also in jQuery 1.6.1 !

I found a workaround that can be tested here : http://jsfiddle.net/qbPW9/1/

The implied correction in jquery-1.6.2 would be to add the line (2279) :

>> elem.setAttribute( name, "" );
elem.removeAttribute( name );