| Index: LayoutTests/imported/web-platform-tests/custom-elements/creating-and-passing-registries/share-registry-create-document.html
|
| diff --git a/LayoutTests/imported/web-platform-tests/custom-elements/creating-and-passing-registries/share-registry-create-document.html b/LayoutTests/imported/web-platform-tests/custom-elements/creating-and-passing-registries/share-registry-create-document.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..6ad8fcd1b53fc755569f1e59eb202d07adedf929
|
| --- /dev/null
|
| +++ b/LayoutTests/imported/web-platform-tests/custom-elements/creating-and-passing-registries/share-registry-create-document.html
|
| @@ -0,0 +1,52 @@
|
| +<!DOCTYPE html>
|
| +<html>
|
| +<head>
|
| +<title>Document, created with createHTMLDocument or createDocument with HTML namespace, should share registry with the associated document</title>
|
| +<meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
|
| +<meta name="assert" content="When DOMImplementation's createDocument method is invoked with namespace set to HTML Namespace or when the createHTMLDocument method is invoked, use the registry of the associated document to the new instance.">
|
| +<link rel="help" href="http://www.w3.org/TR/custom-elements/#creating-and-passing-registries">
|
| +<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();
|
| + var name = 'x-frame';
|
| +
|
| + var GeneratedConstructor = doc.registerElement(name);
|
| + var doc2 = doc.implementation.createHTMLDocument('Document 2');
|
| + assert_throws(
|
| + 'NotSupportedError',
|
| + function() { doc2.registerElement(name); },
|
| + 'Registering a custom element type name that is already registered in a shared ' +
|
| + 'registry should throw an exception');
|
| +
|
| + var xframe = doc2.createElement(name);
|
| + assert_true(xframe instanceof GeneratedConstructor,
|
| + 'Created element should be x-frame instance');
|
| +}, 'Document created by createHTMLDocument should share an existing registry');
|
| +
|
| +
|
| +test(function() {
|
| + var doc = newHTMLDocument();
|
| + var name = 'x-frame-1';
|
| +
|
| + var GeneratedConstructor = doc.registerElement(name);
|
| + var doc2 = doc.implementation.createDocument(HTML_NAMESPACE, 'html', null);
|
| + assert_throws(
|
| + 'NotSupportedError',
|
| + function() { doc2.registerElement(name); },
|
| + 'Exception should be thrown for custom element, ' +
|
| + 'which is already registered in shared registry');
|
| +
|
| + var xframe = doc2.createElement(name);
|
| + assert_true(xframe instanceof GeneratedConstructor,
|
| + 'Created element should be x-frame instance');
|
| +}, 'Document created by createDocument with HTML namespace should share an existing registry');
|
| +</script>
|
| +</body>
|
| +</html>
|
|
|