details-ancestor.html (1351B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>Selecting internal node</title> 4 <script src=/resources/testharness.js></script> 5 <script src=/resources/testharnessreport.js></script> 6 <script src="/resources/testdriver.js"></script> 7 <script src="/resources/testdriver-vendor.js"></script> 8 <script src="/resources/testdriver-actions.js"></script> 9 <link rel="stylesheet" href="/fonts/ahem.css"> 10 <style> 11 details { 12 font: 16px/1 Ahem; 13 } 14 </style> 15 <details id="details"></details> 16 <script> 17 promise_test(async () => { 18 await new test_driver.Actions() 19 .pointerMove(5, 5, {origin: details}) 20 .pointerDown() 21 .pointerMove(50, 50) 22 .pointerUp() 23 .send(); 24 const selection = getSelection(); 25 26 if (selection.anchorNode === null) { 27 // <details> is not selectable, which is acceptable 28 return; 29 } 30 31 // Gecko throws when accessing any property from DOM-invisible node 32 // so check we can access something 33 assert_equals(selection.anchorNode.constructor.name, "HTMLDetailsElement"); 34 assert_equals(selection.anchorOffset, 0); 35 // Gecko limits the selection inside <details> while Blink does not 36 // so check something general 37 assert_equals(selection.focusNode.nodeType, Node.ELEMENT_NODE); 38 assert_equals(selection.focusOffset, 0); 39 }, "Selecting the default summary of <details> should report a DOM-visible ancestor"); 40 </script>