test-006.html (1393B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>Shadow DOM Test: A_10_01_02_06_01</title> 5 <link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru"> 6 <link rel="help" href="http://www.w3.org/TR/2013/WD-shadow-dom-20130514/#shadow-root-methods"> 7 <meta name="assert" content="ShadowRoot Object: Element? elementFromPoint(float x, float y) method"> 8 <script src="/resources/testharness.js"></script> 9 <script src="/resources/testharnessreport.js"></script> 10 <script src="../../../../../html/resources/common.js"></script> 11 </head> 12 <body> 13 <div id="log"></div> 14 <script> 15 test(function () { 16 17 var d = newHTMLDocument(); 18 19 var el = d.createElement('div'); 20 d.body.appendChild(el); 21 22 try { 23 el.elementFromPoint(1, 1); 24 assert_true(false, 'TypeMismatchError should be thrown'); 25 } catch(e) { 26 assert_true(e instanceof TypeError, 'Wrong error type'); 27 } 28 29 }, 'A_10_01_02_06_01_T01'); 30 31 // Added test for checking if elementFromPoint() method is existing on Shadowroot. 32 test(function () { 33 34 var d = newHTMLDocument(); 35 36 var el = d.createElement('div'); 37 38 var s = el.attachShadow({mode: 'open'}); 39 d.body.appendChild(el); 40 41 if (typeof(s) == 'undefined' || typeof (s.elementFromPoint(1, 1)) != 'object') { 42 assert_true(false, 'Shadowroot doesn\'t have elementFromPoint() method.' ); 43 } 44 45 }, 'A_10_01_02_06_01_T02'); 46 </script> 47 </body> 48 </html>