[Webkit-unassigned] [Bug 206360] New: [GTK] 'insertHTML' command influenced by local style
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Thu Jan 16 09:38:44 PST 2020
https://bugs.webkit.org/show_bug.cgi?id=206360
Bug ID: 206360
Summary: [GTK] 'insertHTML' command influenced by local style
Product: WebKit
Version: Other
Hardware: Unspecified
OS: Unspecified
Status: NEW
Severity: Normal
Priority: P2
Component: WebKitGTK
Assignee: webkit-unassigned at lists.webkit.org
Reporter: mcrha at redhat.com
CC: bugs-noreply at webkitgtk.org
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>
--
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/20200116/39303da1/attachment.htm>
More information about the webkit-unassigned
mailing list