| OLD | NEW |
| 1 <!doctype html> | 1 <!doctype html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>Set/Release capture + relatedTarget</title> | 4 <title>Set/Release capture + relatedTarget</title> |
| 5 <meta name="viewport" content="width=device-width"> | 5 <meta name="viewport" content="width=device-width"> |
| 6 <link rel="stylesheet" type="text/css" href="pointerevent_styles.css"> | 6 <link rel="stylesheet" type="text/css" href="pointerevent_styles.css"> |
| 7 <script src="/resources/testharness.js"></script> | 7 <script src="/resources/testharness.js"></script> |
| 8 <script src="/resources/testharnessreport.js"></script> | 8 <script src="/resources/testharnessreport.js"></script> |
| 9 <script src="pointerevent_support.js"></script> | 9 <script src="pointerevent_support.js"></script> |
| 10 </head> | 10 </head> |
| 11 <body> | 11 <body> |
| 12 <h1>Pointer Events Capture Test - capture and relatedTarget</h1> | 12 <h1>Pointer Events Capture Test - capture and relatedTarget</h1> |
| 13 <h4> | 13 <h4> |
| 14 Test Description: This test checks if setCapture/releaseCapture func
tions works properly. Complete the following actions: | 14 Test Description: This test checks if setCapture/releaseCapture func
tions works properly. Complete the following actions: |
| 15 <ol> | 15 <ol> |
| 16 <li> Put your mouse over the lower rectangle. pointerover should
be received for the purple rectangle | 16 <li> Put your mouse over the purple rectangle. pointerover shoul
d be received for the purple rectangle |
| 17 <li> Press and hold left mouse button over "Set Capture" button | 17 <li> Press and hold left mouse button over "Set Capture" button |
| 18 <li> Put your mouse over the upper rectangle. pointerover should
be received for the black rectangle | 18 <li> Move your mouse. pointerover should be received for the bla
ck rectangle |
| 19 <li> Release left mouse button to complete the test. | 19 <li> Release left mouse button to complete the test. |
| 20 </ol> | 20 </ol> |
| 21 </h4> | 21 </h4> |
| 22 Test passes if the proper behavior of the events is observed. | 22 Test passes if the proper behavior of the events is observed. |
| 23 | 23 |
| 24 <div id="target0" style="background:black; color:white"></div> | 24 <div id="target0" style="background:black; color:white"></div> |
| 25 <br> | 25 <br> |
| 26 <div id="target1" style="background:purple; color:white"></div> | 26 <div id="target1" style="background:purple; color:white"></div> |
| 27 <br> | 27 <br> |
| 28 <input type="button" id="btnCapture" value="Set Capture"> | 28 <input type="button" id="btnCapture" value="Set Capture"> |
| (...skipping 29 matching lines...) Expand all Loading... |
| 58 | 58 |
| 59 on_event(target0, 'lostpointercapture', function(e) { | 59 on_event(target0, 'lostpointercapture', function(e) { |
| 60 log("lostpointercapture", document.getElementById('target0')
); | 60 log("lostpointercapture", document.getElementById('target0')
); |
| 61 isPointerCapture = false; | 61 isPointerCapture = false; |
| 62 }); | 62 }); |
| 63 | 63 |
| 64 run(); | 64 run(); |
| 65 } | 65 } |
| 66 | 66 |
| 67 function run() { | 67 function run() { |
| 68 // After invoking the setPointerCapture method on an element, su
bsequent pointer events for the specified pointer must be targeted at that eleme
nt. | 68 // After invoking the setPointerCapture method on an element, su
bsequent pointer events for the specified pointer must be targeted at that eleme
nt |
| 69 // Additionally, the relatedTarget property of all such pointer
events must be set to null. | 69 // and boundary events should be sent accordingly and relatedTar
get should behave normally. |
| 70 // TA: 13.3 | |
| 71 on_event(target0, "pointerover", function (event) { | 70 on_event(target0, "pointerover", function (event) { |
| 72 log("pointerover", document.getElementById('target0')); | 71 log("pointerover", document.getElementById('target0')); |
| 73 if(isPointerCapture && isPointeroverGot) { | 72 if(isPointerCapture && isPointeroverGot) { |
| 74 test(function() { | 73 test(function() { |
| 75 assert_true(event.relatedTarget==null, "relatedTarge
t is null when the capture is set") | 74 assert_not_equals(event.relatedTarget, null, "relate
dTarget should not be null even when the capture is set") |
| 76 }, "relatedTarget is null when the capture is set. relat
edTarget is " + event.relatedTarget); | 75 }, "relatedTarget should not be null even when the captu
re is set."); |
| 77 done(); | 76 done(); |
| 78 } | 77 } |
| 79 }); | 78 }); |
| 80 | 79 |
| 81 on_event(target1, "pointerover", function (event) { | 80 on_event(target1, "pointerover", function (event) { |
| 82 detected_pointertypes[ event.pointerType ] = true; | 81 detected_pointertypes[ event.pointerType ] = true; |
| 83 if(!isPointeroverGot) { | 82 if(!isPointeroverGot) { |
| 84 test(function() { | 83 test(function() { |
| 85 assert_true(isPointerCapture==false, "pointerover sh
ouldn't trigger for this target when capture is enabled"); | 84 assert_true(isPointerCapture==false, "pointerover sh
ouldn't trigger for this target when capture is enabled"); |
| 86 }, "pointerover shouldn't trigger for the purple rectang
le while the black rectangle has capture"); | 85 }, "pointerover shouldn't trigger for the purple rectang
le while the black rectangle has capture"); |
| 87 isPointeroverGot = true; | 86 isPointeroverGot = true; |
| 88 log("pointerover", document.getElementById('target1')); | 87 log("pointerover", document.getElementById('target1')); |
| 89 } | 88 } |
| 90 }); | 89 }); |
| 91 } | 90 } |
| 92 </script> | 91 </script> |
| 93 <h1>Pointer Events Capture Test</h1> | 92 <h1>Pointer Events Capture Test</h1> |
| 94 <div id="complete-notice"> | 93 <div id="complete-notice"> |
| 95 <p>Test complete: Scroll to Summary to view Pass/Fail Results.</p> | 94 <p>Test complete: Scroll to Summary to view Pass/Fail Results.</p> |
| 96 <p>The following pointer types were detected: <span id="pointertype-
log"></span>.</p> | 95 <p>The following pointer types were detected: <span id="pointertype-
log"></span>.</p> |
| 97 <p>Refresh the page to run the tests again with a different pointer
type.</p> | 96 <p>Refresh the page to run the tests again with a different pointer
type.</p> |
| 98 </div> | 97 </div> |
| 99 <div id="log"></div> | 98 <div id="log"></div> |
| 100 </body> | 99 </body> |
| 101 </html> | 100 </html> |
| OLD | NEW |