| OLD | NEW |
| 1 <html xmlns="http://www.w3.org/1999/xhtml"> | 1 <html xmlns="http://www.w3.org/1999/xhtml"> |
| 2 <head> | 2 <head> |
| 3 <script src="../../fast/js/resources/js-test-pre.js"></script> | 3 <script src="../../fast/js/resources/js-test-pre.js"></script> |
| 4 </head> | 4 </head> |
| 5 <body onload="eventTestOne()"> | 5 <body onload="eventTestOne()"> |
| 6 | 6 |
| 7 <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlin
k" width="100px" height="100px"> | 7 <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlin
k" width="100px" height="100px"> |
| 8 <defs> | 8 <defs> |
| 9 <rect id="target" fill="red" width="100" height="100" onclick="eventHandle
r(evt)"/> | 9 <rect id="target" fill="red" width="100" height="100" onclick="eventHandle
r(evt)"/> |
| 10 </defs> | 10 </defs> |
| 11 <use id="test" xlink:href="#target"/> | 11 <use id="test" xlink:href="#target"/> |
| 12 </svg> | 12 </svg> |
| 13 | 13 |
| 14 <p id="description"/> | 14 <p id="description"/> |
| 15 <div id="console"/> | 15 <div id="console"/> |
| 16 | 16 |
| 17 <script> | 17 <script> |
| 18 // Setting up the testcase | 18 // Setting up the testcase |
| 19 window.jsTestIsAsync = true; |
| 19 if (window.testRunner) | 20 if (window.testRunner) |
| 20 testRunner.waitUntilDone(); | 21 testRunner.waitUntilDone(); |
| 21 | 22 |
| 22 var useElement = document.getElementById("test"); | 23 var useElement = document.getElementById("test"); |
| 23 var rectElement = document.getElementById("target"); | 24 var rectElement = document.getElementById("target"); |
| 24 | 25 |
| 25 // Start test immediately, to see wheter instanceRoot is already available, as e
xpected. | 26 // Start test immediately, to see wheter instanceRoot is already available, as e
xpected. |
| 26 description("Test SVG use element specific event handling using SVGElementInstan
ce: "); | 27 description("Test SVG use element specific event handling using SVGElementInstan
ce: "); |
| 27 debug("'useElement' is the original use element"); | 28 debug("'useElement' is the original use element"); |
| 28 debug("'rectElement' is the original element which gets cloned by the use elemen
t"); | 29 debug("'rectElement' is the original element which gets cloned by the use elemen
t"); |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 | 205 |
| 205 useElement.instanceRoot.removeEventListener("mouseover", eventHandler, false
); | 206 useElement.instanceRoot.removeEventListener("mouseover", eventHandler, false
); |
| 206 fireSimulatedMouseOverEvent("checkEventListenerNotReachable()", useElement.i
nstanceRoot); | 207 fireSimulatedMouseOverEvent("checkEventListenerNotReachable()", useElement.i
nstanceRoot); |
| 207 fireSimulatedMouseOverEvent("checkEventListenerNotReachable()", rectElement)
; | 208 fireSimulatedMouseOverEvent("checkEventListenerNotReachable()", rectElement)
; |
| 208 fireSimulatedMouseClickEvent("eventTestFour()", rectElement); | 209 fireSimulatedMouseClickEvent("eventTestFour()", rectElement); |
| 209 } | 210 } |
| 210 | 211 |
| 211 function eventTestFour() | 212 function eventTestFour() |
| 212 { | 213 { |
| 213 debug(""); | 214 debug(""); |
| 214 debug("Test #4: Verify that a click event got dispatched to the original tre
e as defined in the markup, when sent to the 'rectElement'"); | 215 debug("Test #4: Verify that a click event got dispatched to the original tre
e as defined in the markup, when sent to the 'rectElement'"); |
| 215 debug(""); | 216 debug(""); |
| 216 | 217 |
| 217 verifyClickEventOnReferenced(); | 218 verifyClickEventOnReferenced(); |
| 218 | 219 |
| 219 fireSimulatedMouseClickEvent("eventTestFive()", useElement.instanceRoot); | 220 fireSimulatedMouseClickEvent("eventTestFive()", useElement.instanceRoot); |
| 220 } | 221 } |
| 221 | 222 |
| 222 function eventTestFive() | 223 function eventTestFive() |
| 223 { | 224 { |
| 224 debug(""); | 225 debug(""); |
| 225 debug("Test #5: Verify that a click event got dispatched to the instance tre
e when sent to the 'useElement.instanceRoot' with an event listener attached to
'rectElement'"); | 226 debug("Test #5: Verify that a click event got dispatched to the instance tre
e when sent to the 'useElement.instanceRoot' with an event listener attached to
'rectElement'"); |
| 226 debug(""); | 227 debug(""); |
| 227 | 228 |
| 228 verifyClickEvent(); | 229 verifyClickEvent(); |
| 229 | 230 |
| 230 // This tests a webkit specific quirk: removeAttribute() on the target eleme
nt, causes us to reclone the shadow tree. | 231 // This tests a webkit specific quirk: removeAttribute() on the target eleme
nt, causes us to reclone the shadow tree. |
| 231 // All event listener mutations are synchronized with the shadow tree and do
not cause reclones. So if we add the | 232 // All event listener mutations are synchronized with the shadow tree and do
not cause reclones. So if we add the |
| 232 // click event listener to the current instanceRoot, remove the existing cli
ck listener from markup and then fire | 233 // click event listener to the current instanceRoot, remove the existing cli
ck listener from markup and then fire |
| 233 // a click event, we're sure that the shadow tree is recloned before the eve
ntTestSix() function is executed. | 234 // a click event, we're sure that the shadow tree is recloned before the eve
ntTestSix() function is executed. |
| 234 // If eventTestSix() is reached, we've properly preserved the dynamically cr
eated click event listener after recloning. | 235 // If eventTestSix() is reached, we've properly preserved the dynamically cr
eated click event listener after recloning. |
| 235 useElement.instanceRoot.addEventListener("click", eventHandler, false); | 236 useElement.instanceRoot.addEventListener("click", eventHandler, false); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 verifyClickEvent(); | 276 verifyClickEvent(); |
| 276 | 277 |
| 277 // Cleanup | 278 // Cleanup |
| 278 useElement.instanceRoot.removeEventListener("click", eventHandler, false); | 279 useElement.instanceRoot.removeEventListener("click", eventHandler, false); |
| 279 fireSimulatedMouseClickEvent("checkEventListenerNotReachable()", useElement.
instanceRoot); | 280 fireSimulatedMouseClickEvent("checkEventListenerNotReachable()", useElement.
instanceRoot); |
| 280 fireSimulatedMouseClickEvent("checkEventListenerNotReachable()", rectElement
); | 281 fireSimulatedMouseClickEvent("checkEventListenerNotReachable()", rectElement
); |
| 281 | 282 |
| 282 // Indicate finish | 283 // Indicate finish |
| 283 rectElement.setAttribute("fill", "green"); | 284 rectElement.setAttribute("fill", "green"); |
| 284 | 285 |
| 285 // Load test finishing script | 286 finishJSTest(); |
| 286 var script = document.createElement('script'); | |
| 287 script.onload = completeTest; | |
| 288 script.src = "../../fast/js/resources/js-test-post.js"; | |
| 289 document.body.appendChild(script); | |
| 290 } | |
| 291 | |
| 292 function completeTest() | |
| 293 { | |
| 294 if (window.testRunner) | |
| 295 testRunner.notifyDone(); | |
| 296 } | 287 } |
| 297 </script> | 288 </script> |
| 298 | 289 |
| 299 </body> | 290 </body> |
| 300 </html> | 291 </html> |
| OLD | NEW |