Index: third_party/WebKit/LayoutTests/imported/wpt/web-animations/testcommon.js |
diff --git a/third_party/WebKit/LayoutTests/imported/wpt/web-animations/testcommon.js b/third_party/WebKit/LayoutTests/imported/wpt/web-animations/testcommon.js |
index 5ba03082a9cd65bd7ae916ad99d877e879896484..e375a0f8741788984f9c7be658a3b88c7396c0ff 100644 |
--- a/third_party/WebKit/LayoutTests/imported/wpt/web-animations/testcommon.js |
+++ b/third_party/WebKit/LayoutTests/imported/wpt/web-animations/testcommon.js |
@@ -28,15 +28,22 @@ if (!window.assert_times_equal) { |
// creates div element, appends it to the document body and |
// removes the created element during test cleanup |
function createDiv(test, doc) { |
+ return createElement(test, 'div', doc); |
+} |
+ |
+// creates element of given tagName, appends it to the document body and |
+// removes the created element during test cleanup |
+// if tagName is null or undefined, returns div element |
+function createElement(test, tagName, doc) { |
if (!doc) { |
doc = document; |
} |
- var div = doc.createElement('div'); |
- doc.body.appendChild(div); |
+ var element = doc.createElement(tagName || 'div'); |
+ doc.body.appendChild(element); |
test.add_cleanup(function() { |
- div.remove(); |
+ element.remove(); |
}); |
- return div; |
+ return element; |
} |
// Creates a style element with the specified rules, appends it to the document |