Skip to content

Commit

Permalink
Make AutoMoveOneLineHandler::Run explicitly ignore caret position w…
Browse files Browse the repository at this point in the history
…hen the destination is removed

The test case removes entire the `<output>` during deleting its content and
that occurs during it moves the content in `<div>` into the preceding `<ruby>`.
Therefore, the destination becomes not connected to the document so that it
fails to track the range of moved contents in the document.

Then, the code does not explicitly mark the caret position is not necessary.
So, we just need to do it.

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

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1872428
gecko-commit: fb88413de9c123d2c96fc69bdb3545586a7b0015
gecko-reviewers: m_kato
  • Loading branch information
masayuki-nakano authored and moz-wptsync-bot committed Jan 13, 2024
1 parent 46ebceb commit 2fb9eb9
Showing 1 changed file with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<script>
document.addEventListener("DOMContentLoaded", () => {
document.designMode = "on";
window.find("AA");
document.addEventListener(
"selectionchange",
onSelectionChangeOrDOMNodeInserted,
{once: true}
);
document.querySelector("output").addEventListener(
"DOMNodeInserted",
onSelectionChangeOrDOMNodeInserted
);
document.execCommand("forwarddelete");
});

function onSelectionChangeOrDOMNodeInserted() {
document.execCommand("delete");
document.querySelector("output").value = "";
}
</script>
</head>
<body>
<output>
<ruby></ruby>
<div>
AAA
</div></output></body>
</html>

0 comments on commit 2fb9eb9

Please sign in to comment.