diff options
Diffstat (limited to 'testing/web-platform/tests/html/webappapis/scripting/events/event-handler-attributes-body-window.html')
-rw-r--r-- | testing/web-platform/tests/html/webappapis/scripting/events/event-handler-attributes-body-window.html | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-attributes-body-window.html b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-attributes-body-window.html new file mode 100644 index 000000000..1c87892cb --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-attributes-body-window.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<title>HTMLBodyElement event handlers</title> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<body> +<script> +function f() { + return 0; +} + +var handlers = ['blur','error','focus','load','resize','scroll', + 'afterprint','beforeprint','beforeunload','hashchange', + 'languagechange','message','offline','online','pagehide', + 'pageshow','popstate','storage','unload']; +handlers.forEach(function(handler) { + test(function() { + document.body['on' + handler] = f; + assert_equals(window['on' + handler], f); + }, handler); +}); + +handlers.forEach(function(handler) { + document.body['on' + handler] = null; +}); + +handlers.forEach(function(handler) { + test(function() { + assert_equals(document.body['on' + handler], null); + assert_equals(window['on' + handler], null); + }, handler + " removal"); +}); +</script> |