contentEditable-slotted-inherit.html (1613B)
1 <!DOCTYPE html> 2 <meta charset=utf-8> 3 <title>contentEditable inherit from light tree parent</title> 4 <link rel="author" title="Rune Lillesveen" href="mailto:futhark@chromium.org"> 5 <link rel=help href="https://html.spec.whatwg.org/multipage/#contenteditable"> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 <p>You should see the word PASS two times below and no FAIL.</p> 9 <div id="host1" contenteditable><div>FAILPASS</div></div> 10 <div id="host2" contenteditable><div>FAILPASS</div></div> 11 <script> 12 test(() => { 13 const root = host1.attachShadow({mode:"open"}); 14 root.innerHTML = "<slot></slot>"; 15 const text = host1.firstChild.firstChild; 16 const selection = window.getSelection(); 17 selection.collapse(text, 0); 18 selection.extend(text, 4); 19 host1.focus(); 20 document.execCommand("delete"); 21 host1.blur(); 22 assert_equals(text.data, "PASS", "Text should be PASS after FAIL is deleted"); 23 }, "Slotted child of contenteditable host should be editable - slot direct child of shadow root"); 24 25 test(() => { 26 const root = host2.attachShadow({mode:"open"}); 27 root.innerHTML = "<div><slot></slot></div>"; 28 const text = host2.firstChild.firstChild; 29 const selection = window.getSelection(); 30 selection.collapse(text, 0); 31 selection.extend(text, 4); 32 host2.focus(); 33 document.execCommand("delete"); 34 host2.blur(); 35 assert_equals(text.data, "PASS", "Text should be PASS after FAIL is deleted"); 36 }, "Slotted child of contenteditable host should be editable - slot wrapped in shadow tree ancestor"); 37 </script>