WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED CONFIGURATION CHANGED
227196
document.documentElement.removeAttribute('dir') won't reset to previous state
https://bugs.webkit.org/show_bug.cgi?id=227196
Summary
document.documentElement.removeAttribute('dir') won't reset to previous state
diegocardoso
Reported
2021-06-20 12:34:56 PDT
If you have a page in LTR mode and call `document.documentElement.setAttribute('dir', 'rtl')` to force the page to be in RTL mode, you would expect that calling `document.documentElement.removeAttribute('dir')` restores it to the previous state. But in Safari, unlike Chrome and Firefox, nothing happens and the direction mode remains on RTL. You can force it to go back to LRT by calling `document.documentElement.setAttribute('dir', 'ltr'). I couldn't find on the specs (
https://html.spec.whatwg.org/multipage/dom.html#the-dir-attribute
) any description of how it should behave on this case, but since other browsers that I tested work similarly, meaning that it falls back to the default direction mode, I decided to fill this bug. You can try it on this small example I created:
https://jsfiddle.net/diegocardoso/chm7yk5e/7/
Attachments
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2021-06-27 12:35:17 PDT
<
rdar://problem/79842142
>
Ahmad Saleem
Comment 2
2023-05-23 02:44:08 PDT
I am unable to reproduce this bug in Safari 16.5, where ticking makes it RTL while unticking make it go back to original state and it matches with Chrome Canary 115 and Firefox Nightly 115. Marking this as "RESOLVED CONFIGURATION CHANGED", if it is still an issue, please reopen with updated test case / reduction.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug