[Webkit-unassigned] [Bug 227196] New: document.documentElement.removeAttribute('dir') won't reset to previous state

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Jun 20 12:34:56 PDT 2021


https://bugs.webkit.org/show_bug.cgi?id=227196

            Bug ID: 227196
           Summary: document.documentElement.removeAttribute('dir') won't
                    reset to previous state
           Product: WebKit
           Version: Safari 14
          Hardware: Mac (Intel)
                OS: macOS 11
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: DOM
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: diegopc86 at gmail.com

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/

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20210620/b159758e/attachment.htm>


More information about the webkit-unassigned mailing list