WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
206360
[GTK] 'insertHTML' command influenced by local style and inconsistent
https://bugs.webkit.org/show_bug.cgi?id=206360
Summary
[GTK] 'insertHTML' command influenced by local style and inconsistent
Milan Crha
Reported
2020-01-16 09:38:44 PST
The 'insertHTML' command is unreliable, it can strip content of the inserted HTML data based on the current document style, which is an error, from my point of view. Furthermore, it doesn't do that always, only the second (and following) time(s). Steps: a) run: MiniBrowser --editor-mode b) open the web inspector and execute these commands in this order in the JavaScript console: document.documentElement.innerHTML = "<head><style>span.xxx { display:none;}</style></head><body><div><br></div></body>"; document.getSelection().setPosition(document.body.firstElementChild, 1); document.execCommand("insertHTML", false, "<span class='yyy'><span class='zzz'>zzz</span><span class='xxx'>xxx</span></span>OOO"); document.execCommand("insertHTML", false, "<span class='yyy'><span class='zzz'>zzz</span><span class='xxx'>xxx</span></span>OOO"); c) switch to the Elements tab and observer the structure under <body>. Note I called 'insertHTML' twice with the same HTML data, thus I expect to see two same HTML code being inserted (in this case exactly the same HTML as entered in the command), but it shows this instead: <body> <div> <span class="yyy"> <span class="zzz">zzz</span> <span class="xxx">xxx</span> </span> "OOO" <span class="zzz">zzz</span> "OOO" </div> </body> Thus, from the second call only the "zzz" and "OOO" left, even it should be enclosed in "yyy" and have the "xxx" there as well. When I remove the <style> from the <head> it behaves as expected, thus it seems like some optimization/normalization had been applied, causing this error. I expect: 1) to have 'insertHTML' command behave consistently (should insert the same data, when the same HTML is passed in); 2) should not be influenced by currently active CSS rules. For the record, this is what I expect to see in HTML structure: <body> <div> <span class="yyy"> <span class="zzz">zzz</span> <span class="xxx">xxx</span> </span> "OOO" <span class="yyy"> <span class="zzz">zzz</span> <span class="xxx">xxx</span> </span> "OOO" </div> </body>
Attachments
Add attachment
proposed patch, testcase, etc.
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