Index: LayoutTests/imported/web-platform-tests/custom-elements/instantiating-custom-elements/extensions-to-document-interface/create-element-type-extension-unresolved.html |
diff --git a/LayoutTests/imported/web-platform-tests/custom-elements/instantiating-custom-elements/extensions-to-document-interface/create-element-type-extension-unresolved.html b/LayoutTests/imported/web-platform-tests/custom-elements/instantiating-custom-elements/extensions-to-document-interface/create-element-type-extension-unresolved.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5919ed6eab5644da873cbd0c8c6c9c896bc6cb26 |
--- /dev/null |
+++ b/LayoutTests/imported/web-platform-tests/custom-elements/instantiating-custom-elements/extensions-to-document-interface/create-element-type-extension-unresolved.html |
@@ -0,0 +1,50 @@ |
+<!DOCTYPE html> |
+<html> |
+<head> |
+<title>Document.createElement() and Document.createElementNS() create custom element of type, specified by localName argument</title> |
+<meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru"> |
+<meta name="assert" content="If an element definition with matching localName, namespace, and TYPE is not registered with token's document, set TYPE to localName"> |
+<link rel="help" href="http://www.w3.org/TR/custom-elements/#extensions-to-document-interface-to-instantiate"> |
+<script src="../../../../../resources/testharness.js"></script> |
+<script src="../../../../../resources/testharnessreport.js"></script> |
+<script src="../../testcommon.js"></script> |
+<link rel="stylesheet" href="../../../../../resources/testharness.css"> |
+</head> |
+<body> |
+<div id="log"></div> |
+<script> |
+test (function() { |
+ var doc = newHTMLDocument(); |
+ HTML5_ELEMENTS.forEach(function(tagName) { |
+ var obj = doc.createElement(tagName); |
+ var name = 'x-a-' + tagName; |
+ var proto = Object.create(obj.constructor.prototype); |
+ var customElement = doc.createElement(tagName, name); |
+ assert_equals(Object.getPrototypeOf(customElement), Object.getPrototypeOf(obj), |
+ 'Unregistered custom element type should be a local name'); |
+ |
+ var GeneratedConstructor = doc.registerElement(name, {prototype: proto, extends: tagName}); |
+ assert_equals(Object.getPrototypeOf(customElement), GeneratedConstructor.prototype, |
+ 'Registered custom element type should be the type extension'); |
+ }); |
+}, 'If typeExtension is unresolved when createElement called then local name is a type'); |
+ |
+ |
+test (function() { |
+ var doc = newHTMLDocument(); |
+ HTML5_ELEMENTS.forEach(function(tagName) { |
+ var obj = doc.createElement(tagName); |
+ var name = 'x-b-' + tagName; |
+ var proto = Object.create(obj.constructor.prototype); |
+ var customElement = doc.createElementNS(HTML_NAMESPACE, tagName, name); |
+ assert_equals(Object.getPrototypeOf(customElement), Object.getPrototypeOf(obj), |
+ 'Custom element type should be a local name'); |
+ |
+ var GeneratedConstructor = doc.registerElement(name, {prototype: proto, extends: tagName}); |
+ assert_equals(Object.getPrototypeOf(customElement), GeneratedConstructor.prototype, |
+ 'Custom element type should be the type extension'); |
+ }); |
+}, 'If typeExtension is unresolved when createElementNS called then local name is a type'); |
+</script> |
+</body> |
+</html> |