Bug Tracker

Modify

Ticket #10136 (closed bug: duplicate)

Opened 21 months ago

Last modified 21 months ago

.removeAttr has problems in chrome

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

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

comment:1 Changed 21 months ago by timmywil

  • Priority changed from undecided to high
  • Resolution set to duplicate
  • Status changed from new to closed
  • Component changed from unfiled to attributes

comment:2 Changed 21 months ago by timmywil

Duplicate of #9699.

comment:3 Changed 21 months 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 );

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.