mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-26 04:09:50 +00:00

I misunderstood the traditional behavior before bug 1789967, that is, `HTMLEditor` collapsed `Selection` to end of the deepest last child container element **or text node** of the `<body>`, rather than to end of **only** the deepest last child container element. This misunderstanding caused the backout of the first landing, but I didn't realize this mistake. Therefore, this patch makes the crashtests which are touched in bug 1789967 and the collapsed point is at a text node (or failed to consider the collapsed point) collapse `Selection` to end of the deepest last text node of their `<body>` elements. Differential Revision: https://phabricator.services.mozilla.com/D158177
30 lines
850 B
HTML
30 lines
850 B
HTML
<script>
|
|
window.addEventListener('load', () => {
|
|
// For emulating the traditional behavior, collapse Selection to end of the
|
|
// <body> (at the comment node).
|
|
getSelection().collapse(document.body, document.body.childNodes.length);
|
|
const map = document.querySelector("map");
|
|
const anchor = document.querySelector("a");
|
|
map.replaceChild(
|
|
anchor,
|
|
map.childNodes[(2828994049 % map.childNodes.length)]
|
|
);
|
|
anchor.innerHTML = "<o>";
|
|
getSelection().setBaseAndExtent(
|
|
document,
|
|
(2019424593 % document.childNodes.length),
|
|
document.documentElement,
|
|
(3503355750 % document.documentElement.childNodes.length)
|
|
);
|
|
document.designMode = "on";
|
|
document.execCommand("forwardDelete");
|
|
document.execCommand("forwardDelete");
|
|
});
|
|
</script>
|
|
<sub contenteditable>
|
|
<map>
|
|
<address></address>
|
|
<a>
|
|
</a>
|
|
<!-- COMMENT --></body>
|