diff options
Diffstat (limited to 'testing/web-platform/tests/uievents/legacy-domevents-tests/submissions/Microsoft/Event.defaultPrevented.html')
-rw-r--r-- | testing/web-platform/tests/uievents/legacy-domevents-tests/submissions/Microsoft/Event.defaultPrevented.html | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/testing/web-platform/tests/uievents/legacy-domevents-tests/submissions/Microsoft/Event.defaultPrevented.html b/testing/web-platform/tests/uievents/legacy-domevents-tests/submissions/Microsoft/Event.defaultPrevented.html new file mode 100644 index 000000000..8acd3cb97 --- /dev/null +++ b/testing/web-platform/tests/uievents/legacy-domevents-tests/submissions/Microsoft/Event.defaultPrevented.html @@ -0,0 +1,68 @@ +<!DOCTYPE html> +<html> + <head> + <title> W3C DOM Level 3 Event Object Property: defaultPrevented </title> + <script type="text/javascript"> + var PassTest = function() + { + document.getElementById("testresult").firstChild.data = "PASS"; + } + + var FailTest = function() + { + document.getElementById("testresult").firstChild.data = "FAIL"; + } + + var EVENT = "click"; + var TARGET; + + window.onload = function() + { + try + { + TARGET = document.getElementById("target"); + TARGET.addEventListener(EVENT, TestCapture, true); + } + catch(ex) + { + FailTest(); + } + } + + function TestCapture(evt) + { + try + { + evt.preventDefault(); + + if ((evt.type == EVENT) && (evt.defaultPrevented == true)) + { + PassTest(); + } + else + { + FailTest(); + } + } + catch(ex) + { + FailTest(); + } + } + </script> + </head> + <body> + <h4> + Test Description: + Event listeners can cancel default actions of cancelable event objects by invoking the Event.preventDefault() + method, and determine whether an event has been canceled through the Event.defaultPrevented attribute. + </h4> + + Click the hyperlink: + <a href="http://samples.msdn.microsoft.com/ietestcenter/" id="target">http://samples.msdn.microsoft.com/ietestcenter</a> + + <p>Test passes if the word "PASS" appears below after clicking the hyperlink and the page does not navigate away.</p> + <div>Test result: </div> + <div id='testresult'>FAIL</div> + </body> +</html> |