Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html>
<html>
<head>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<div contenteditable></div>
<pre id="test">
<script class="testbody" type="application/javascript">
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(function() {
const editableInnerHTML =
`<table>
<tr><td>ABCDEFG</td><td>HIJKLMN</td></tr>
<tr><td>ABCDEFG</td><td>HIJKLMN</td></tr>
<tr><td>ABCDEFG</td><td>HIJKLMN</td></tr>
</table>`;
document.execCommand("enableObjectResizing", false, "false");
document.execCommand("enableInlineTableEditing", false, "true");
function doTest(aDescription, aTable) {
synthesizeMouseAtCenter(aTable, {});
isnot(
aTable.getAttribute("_moz_resizing"),
"true",
`${aDescription}: _moz_resizing attribute shouldn't be true without object resizing`
);
const tr2 = aTable.querySelector("tr + tr");
synthesizeMouse(tr2, 0, tr2.clientHeight / 2, {});
ok(
!tr2.isConnected,
`${aDescription}: The second <tr> element should've been removed by a click`
);
}
const editingHost = document.querySelector("div[contenteditable]");
editingHost.innerHTML = editableInnerHTML;
doTest("Testing in Light DOM", editingHost.querySelector("table"));
editingHost.remove();
const shadowHost = document.createElement("div");
document.body.insertBefore(shadowHost, document.body.firstChild);
const shadowRoot = shadowHost.attachShadow({mode: "open"});
shadowRoot.appendChild(document.createElement("div"));
shadowRoot.firstChild.setAttribute("contenteditable", "");
shadowRoot.firstChild.innerHTML = editableInnerHTML;
doTest("Testing in Shadow DOM", shadowRoot.firstChild.querySelector("table"));
shadowHost.remove();
SimpleTest.finish();
});
</script>
</pre>
</body>
</html>