diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /testing/web-platform/tests/custom-elements/v0/instantiating/extensions-to-document-interface/created-callback-create-element-ns.html | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/web-platform/tests/custom-elements/v0/instantiating/extensions-to-document-interface/created-callback-create-element-ns.html')
-rw-r--r-- | testing/web-platform/tests/custom-elements/v0/instantiating/extensions-to-document-interface/created-callback-create-element-ns.html | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/testing/web-platform/tests/custom-elements/v0/instantiating/extensions-to-document-interface/created-callback-create-element-ns.html b/testing/web-platform/tests/custom-elements/v0/instantiating/extensions-to-document-interface/created-callback-create-element-ns.html new file mode 100644 index 000000000..7bf09601c --- /dev/null +++ b/testing/web-platform/tests/custom-elements/v0/instantiating/extensions-to-document-interface/created-callback-create-element-ns.html @@ -0,0 +1,72 @@ +<!DOCTYPE html> +<html> +<head> +<title>Document.createElementNS() must enqueue created callback for registered custom element type</title> +<meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru"> +<meta name="assert" content="Document.createElementNS() must enqueue created callback for registered custom element type"> +<link rel="help" href="http://www.w3.org/TR/custom-elements/#extensions-to-document-interface-to-instantiate"> +<link rel="help" href="http://www.w3.org/TR/custom-elements/#types-of-callbacks"> +<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(); + var proto = newHTMLElementPrototype(); + var name = 'x-a'; + + doc.registerElement(name, {prototype: proto}); + var customElement = doc.createElementNS(HTML_NAMESPACE, name); + assert_equals(proto.createdCallbackCalledCounter, 1, + 'Callback created should be enqueued by Document.createElementNS()'); +}, 'Test Document.createElementNS() without typeExtension argument enqueues created callback'); + + +test(function() { + var doc = newHTMLDocument(); + var proto = newHTMLElementPrototype(); + var name = 'x-b'; + + doc.registerElement(name, {prototype: proto}); + var customElement = doc.createElementNS(HTML_NAMESPACE, name, name); + assert_equals(proto.createdCallbackCalledCounter, 1, + 'Callback created should be enqueued by Document.createElementNS()'); +}, 'Test Document.createElementNS() with typeExtension argument enqueues created callback'); + + +test(function() { + var doc = newHTMLDocument(); + var proto = newHTMLElementPrototype(); + var name = 'x-c'; + var customElement = doc.createElementNS(HTML_NAMESPACE, name); + assert_equals(proto.createdCallbackCalledCounter, 0, + 'Document.createElementNS() should not enqueue created callback ' + + 'for unresolved custom element'); + + doc.registerElement(name, {prototype: proto}); + assert_equals(proto.createdCallbackCalledCounter, 1, + 'Callback created should be called after custom element is registered'); +}, 'Document.createElementNS() should not enqueue created callback ' + + 'for unresolved custom element'); + + +test(function() { + var doc = newHTMLDocument(); + HTML5_ELEMENTS.forEach(function(tagName) { + var obj = doc.createElement(tagName); + var name = 'x-d-' + tagName; + var proto = newCustomElementPrototype(Object.create(obj.constructor.prototype)); + doc.registerElement(name, {prototype: proto, extends: tagName}); + var customElement = doc.createElementNS(HTML_NAMESPACE, tagName, name); + + assert_equals(proto.createdCallbackCalledCounter, 1, + 'Callback created should be enqueued by Document.createElementNS()'); + }); +}, 'Test Document.createElementNS() enqueues created callback for custom elements ' + + 'that are extensions of HTML5 elements'); +</script> +</body> +</html> |