gecko-dev/editor/libeditor/crashtests/1426709.html
Masayuki Nakano d9e3ea7e57 Bug 1426709 - Make HTMLEditor update selection ancestor limit synchronously when editing host is changed to ancestor element r=smaug
`HTMLEditor` initializes selection ancestor limit when it receives `focus`
event.  If `Document.execCommand()` is called immediately after an
ancestor of active editing host becomes new editing host,
`HTMLEditor::GetActiveEditingHost()` returns the new one, but selection
ancestor limit is still the previous one.  This mismatch causes a lot of
bugs.  Therefore, this patch makes `nsGenericHTMLElement` notifies `HTMLEditor`
of an element becoming `contenteditable`, and makes `HTMLEditor` update
selection ancestor limit only when the new editing host is ancestor of
old selection ancestor limit.

Differential Revision: https://phabricator.services.mozilla.com/D32823

--HG--
extra : moz-landing-system : lando
2019-06-04 08:42:43 +00:00

18 lines
389 B
HTML

<script>
function go() {
a.setAttribute("contenteditable", "true");
b.addEventListener("DOMNodeRemoved", eh);
b.appendChild(c);
}
function eh() {
document.body.appendChild(b);
document.execCommand("justifyFull", false);
document.execCommand("delete", false);
}
</script>
<body onload=go()>
<li id="a">
A
<pre id="b" contenteditable="true">
<input autofocus="autofocus" id="c">