Index: LayoutTests/fast/dom/global-event-handlers.html |
diff --git a/LayoutTests/fast/dom/global-event-handlers.html b/LayoutTests/fast/dom/global-event-handlers.html |
index 1bba6280ad86b92318ad229c990864381f4b3bc5..0745533cb6ba467ce2ab196208251f4b1ac87ff4 100644 |
--- a/LayoutTests/fast/dom/global-event-handlers.html |
+++ b/LayoutTests/fast/dom/global-event-handlers.html |
@@ -2,9 +2,10 @@ |
<title>GlobalEventHandlers test</title> |
<script src="../../resources/testharness.js"></script> |
<script src="../../resources/testharnessreport.js"></script> |
+<script src="script-tests/event-handlers.js"></script> |
<script> |
// attribute list from WHATWG HTML Living Standard r8212 |
-var attributes = [ |
+[ |
"onabort", |
"onblur", |
"onerror", |
@@ -64,72 +65,7 @@ var attributes = [ |
"ontimeupdate", |
"onvolumechange", |
"onwaiting" |
-]; |
-function getObject(interface) { |
- switch(interface) { |
- case "Element": |
- var e = document.createElementNS("http://example.com/", "example"); |
- assert_true(e instanceof Element); |
- assert_false(e instanceof HTMLElement); |
- assert_false(e instanceof SVGElement); |
- return e; |
- case "HTMLElement": |
- var e = document.createElement("html"); |
- assert_true(e instanceof HTMLElement); |
- return e; |
- case "SVGElement": |
- var e = document.createElementNS("http://www.w3.org/2000/svg", "rect"); |
- assert_true(e instanceof SVGElement); |
- return e; |
- case "Document": |
- assert_true(document instanceof Document); |
- return document; |
- case "Window": |
- assert_true(window instanceof Window); |
- return window; |
- } |
- assert_unreached(); |
-} |
-function testSet(interface, attribute) { |
- test(function() { |
- var object = getObject(interface); |
- function nop() {} |
- assert_equals(object[attribute], null, "Initially null"); |
- object[attribute] = nop; |
- assert_equals(object[attribute], nop, "Return same function"); |
- document[attribute] = ""; |
- assert_equals(document[attribute], null, "Return null after setting string"); |
- }, "Set " + interface + "." + attribute); |
-} |
-function testReflect(interface, attribute) { |
- test(function() { |
- var element = getObject(interface); |
- assert_equals(element.getAttribute(attribute), null, "Initially null"); |
- element.setAttribute(attribute, "return"); |
- assert_equals(element.getAttribute(attribute), "return", "Return same string"); |
- assert_equals(typeof element[attribute], "function", "Convert to function"); |
- }, "Reflect " + interface + "." + attribute); |
-} |
-// Object.propertyIsEnumerable cannot be used because it doesn't |
-// work with properties inherited through the prototype chain. |
-var enumerable = { |
- "Element": {}, |
- "HTMLElement": {}, |
- "SVGElement": {}, |
- "Document": {}, |
- "Window": {} |
-}; |
-Object.keys(enumerable).forEach(function(interface) { |
- for (var attribute in getObject(interface)) { |
- enumerable[interface][attribute] = true; |
- } |
-}); |
-function testEnumerate(interface, attribute) { |
- test(function() { |
- assert_true(enumerable[interface][attribute]); |
- }, "Enumerate " + interface + "." + attribute); |
-} |
-attributes.forEach(function(attribute) { |
+].forEach(function(attribute) { |
test(function() { |
assert_false(attribute in getObject("Element")); |
}, "No Element." + attribute); |