diff options
Diffstat (limited to 'testing/web-platform/tests/custom-elements/v0/instantiating/extensions-to-document-interface/create-element-type-extension-unresolved.html')
-rw-r--r-- | testing/web-platform/tests/custom-elements/v0/instantiating/extensions-to-document-interface/create-element-type-extension-unresolved.html | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/testing/web-platform/tests/custom-elements/v0/instantiating/extensions-to-document-interface/create-element-type-extension-unresolved.html b/testing/web-platform/tests/custom-elements/v0/instantiating/extensions-to-document-interface/create-element-type-extension-unresolved.html new file mode 100644 index 000000000..3eaadf312 --- /dev/null +++ b/testing/web-platform/tests/custom-elements/v0/instantiating/extensions-to-document-interface/create-element-type-extension-unresolved.html @@ -0,0 +1,49 @@ +<!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> +</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> |