Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 1 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /editing/other/shadow_root_iteration_in_block_style.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<script src='/resources/testdriver-vendor.js'></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
<div id="container" contenteditable></div>
<div id="div" contenteditable>hello<span id="span" contenteditable style="color:red">world</span></div>
</body>
<script>
test(() => {
const shadowRoot = container.attachShadow({ mode: "open" });
shadowRoot.innerHTML =
`<span contenteditable>shadow root</span>`;
const span = document.getElementById('span');
const div = document.getElementById('div');
const range = document.createRange();
const selection = window.getSelection();
range.selectNodeContents(span);
selection.removeAllRanges();
selection.addRange(range);
document.execCommand("RemoveFormat");
assert_equals(
div.innerHTML,
'hello<span id="span" contenteditable="" style="">world</span>'
);
}, "RemoveFormat should remove CSS styles of selected node");
</script>