OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <html> |
| 3 <head> |
| 4 <title>setPointerCapture() throws on disconnected node</title> |
| 5 <meta name="viewport" content="width=device-width"> |
| 6 <link rel="stylesheet" type="text/css" href="pointerevent_styles.css"> |
| 7 <script src="/resources/testharness.js"></script> |
| 8 <script src="/resources/testharnessreport.js"></script> |
| 9 <script src="pointerevent_support.js"></script> |
| 10 <script type="text/javascript"> |
| 11 var detected_pointertypes = {}; |
| 12 add_completion_callback(showPointerTypes); |
| 13 var test_setPointerCapture = async_test("setPointerCapture: DOMExcep
tion InvalidStateError"); |
| 14 |
| 15 function run() { |
| 16 var target0 = document.getElementById("target0"); |
| 17 var target1 = document.getElementById("target1"); |
| 18 |
| 19 target1.parentNode.removeChild(target1); |
| 20 |
| 21 on_event(target0, "pointerdown", function (event) { |
| 22 detected_pointertypes[ event.pointerType ] = true; |
| 23 try { |
| 24 target1.setPointerCapture(event.pointerId); |
| 25 |
| 26 test_setPointerCapture.step(function() { |
| 27 assert_unreached("DOMException: InvalidStateError sh
ould have been thrown."); |
| 28 }); |
| 29 } catch (e) { |
| 30 // TA: 13.4 |
| 31 test_setPointerCapture.step(function() { |
| 32 assert_equals(e.name, "InvalidStateError", "DOMExcep
tion should be InvalidStateError"); |
| 33 }); |
| 34 } |
| 35 test_setPointerCapture.done(); |
| 36 }); |
| 37 } |
| 38 </script> |
| 39 </head> |
| 40 <body onload="run()"> |
| 41 <h1>Pointer Event: DOMException InvalidStateError</h1> |
| 42 <h4>Test Description: |
| 43 When the setPointerCapture method is invoked, if the target node doe
s not participate in its ownerDocument's tree, a DOMException with the name Inva
lidStateError must be thrown. |
| 44 </h4> |
| 45 <br> |
| 46 <div id="target0"> |
| 47 Use the mouse, touch or pen to contact this box. |
| 48 </div> |
| 49 <div id="target1"></div> |
| 50 <div id="complete-notice"> |
| 51 <p>The following pointer types were detected: <span id="pointertype-
log"></span>.</p> |
| 52 </div> |
| 53 <div id="log"></div> |
| 54 </body> |
| 55 </html> |
OLD | NEW |