Modify ↓
Ticket #9500 (closed bug: duplicate)
$('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 2 years ago by timmywil
- Priority changed from undecided to low
- Status changed from new to open
- Component changed from unfiled to attributes
comment:2 Changed 2 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?
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

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.