OLD | NEW |
1 <script src="../../js/resources/js-test-pre.js"></script> | 1 <script src="../../js/resources/js-test-pre.js"></script> |
2 <div id='touchtarget' style='width: 50; height: 50'></div> | 2 <div id='touchtarget' style='width: 50; height: 50'></div> |
3 <script> | 3 <script> |
4 description("This test checks that we correctly update the touch event handler c
ount as event handlers are added and removed"); | 4 description("This test checks that we correctly update the touch event handler c
ount as event handlers are added and removed"); |
5 | 5 |
6 debug("Test addEventListener/removeEventListener on the document."); | 6 debug("Test addEventListener/removeEventListener on the document."); |
7 (function() { | 7 (function() { |
8 var listener = function() { } | 8 var listener = function() { } |
9 | 9 |
10 shouldBe('window.internals.touchEventHandlerCount(document)', '0'); | 10 shouldBe('window.internals.touchEventHandlerCount(document)', '0'); |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 shouldBe('window.internals.touchEventHandlerCount(document)', '2'); | 197 shouldBe('window.internals.touchEventHandlerCount(document)', '2'); |
198 | 198 |
199 touchtarget.removeChild(div); | 199 touchtarget.removeChild(div); |
200 shouldBe('window.internals.touchEventHandlerCount(document)', '2'); | 200 shouldBe('window.internals.touchEventHandlerCount(document)', '2'); |
201 | 201 |
202 div.ontouchend = null; | 202 div.ontouchend = null; |
203 div.ontouchmove = null; | 203 div.ontouchmove = null; |
204 shouldBe('window.internals.touchEventHandlerCount(document)', '0'); | 204 shouldBe('window.internals.touchEventHandlerCount(document)', '0'); |
205 })(); | 205 })(); |
206 | 206 |
| 207 debug("Test that nested Documents' touch handlers are properly removed from thei
r parent Document."); |
| 208 (function() { |
| 209 var iframe = document.createElement('iframe'); |
| 210 var touchtarget = document.getElementById('touchtarget'); |
| 211 |
| 212 shouldBe('window.internals.touchEventHandlerCount(document)', '0'); |
| 213 |
| 214 touchtarget.appendChild(iframe); |
| 215 |
| 216 var nestedDocument = iframe.contentWindow.document; |
| 217 nestedDocument.open('text/html', 'replace'); |
| 218 nestedDocument.write("<!DOCTYPE html>\n<html><body onload=\"window.ontouchst
art = function() { };\"></body>"); |
| 219 nestedDocument.close(); |
| 220 |
| 221 shouldBe('window.internals.touchEventHandlerCount(document)', '1'); |
| 222 |
| 223 touchtarget.removeChild(iframe); |
| 224 shouldBe('window.internals.touchEventHandlerCount(document)', '0'); |
| 225 })(); |
207 </script> | 226 </script> |
208 </body> | 227 </body> |
OLD | NEW |