Bug Tracker

Opened 8 years ago

Closed 8 years ago

Last modified 7 years ago

#10136 closed bug (duplicate)

.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.

Change History (3)

comment:1 Changed 8 years ago by timmywil

Component: unfiledattributes
Priority: undecidedhigh
Resolution: duplicate
Status: newclosed

comment:2 Changed 8 years ago by timmywil

Duplicate of #9699.

comment:3 Changed 7 years ago by cdesguez

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 );
Note: See TracTickets for help on using tickets.