Bug Tracker

Modify

Ticket #9500 (closed bug: duplicate)

Opened 3 years ago

Last modified 2 years ago

$('html, body').removeAttr('style') fails in Webkit browsers.

Reported by: waynepurtonsmith@… Owned by:
Priority: low Milestone: 1.next
Component: attributes Version: 1.6.1
Keywords: Cc:
Blocking: Blocked by:

Description

While doing

$('html, body').css('overflow', 'hidden');

It works, but until this part (in Webkit browsers) it fails to do this:

$('html, body').removeAttr('style');

jsFiddle test:  http://jsfiddle.net/9CLfd/

Change History

comment:1 Changed 3 years ago by timmywil

  • Priority changed from undecided to low
  • Status changed from new to open
  • Component changed from unfiled to attributes

This is legit, but it's a quirk in webkit:  http://jsfiddle.net/timmywil/9CLfd/2/

overflow is automatically converted asynchronously to overflow-x/overflow-y, which happens after the removeAttr call. We can fix by adding a call to attr to set the style tag to empty string before removal, but I'd hate to add another function call to every removeAttr.

comment:2 Changed 3 years ago by anonymous

Ah I see now. Thanks for that fix. Surely this "bug" can be fixed in the jQuery core that remove asynchronous styles?

comment:3 Changed 3 years ago by timmywil

  • Status changed from open to closed
  • Resolution set to duplicate

removeAttribute('style') even without this overflow conversion has problems, so I'll close this ticket as a dup of the more enveloping issue.

comment:4 Changed 3 years ago by timmywil

Duplicate of #9699.

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.