OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <html> | |
3 <head> | |
4 <title>Document, created with createHTMLDocument or createDocument with HTML nam
espace, should share registry with the associated document</title> | |
5 <meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru"> | |
6 <meta name="assert" content="When DOMImplementation's createDocument method is i
nvoked with namespace set to HTML Namespace or when the createHTMLDocument metho
d is invoked, use the registry of the associated document to the new instance."> | |
7 <link rel="help" href="http://www.w3.org/TR/custom-elements/#creating-and-passin
g-registries"> | |
8 <script src="../../../../resources/testharness.js"></script> | |
9 <script src="../../../../resources/testharnessreport.js"></script> | |
10 <script src="../testcommon.js"></script> | |
11 </head> | |
12 <body> | |
13 <div id="log"></div> | |
14 <script> | |
15 test(function() { | |
16 var doc = newHTMLDocument(); | |
17 var name = 'x-frame'; | |
18 | |
19 var GeneratedConstructor = doc.registerElement(name); | |
20 var doc2 = doc.implementation.createHTMLDocument('Document 2'); | |
21 assert_throws( | |
22 'NotSupportedError', | |
23 function() { doc2.registerElement(name); }, | |
24 'Registering a custom element type name that is already registered in a
shared ' + | |
25 'registry should throw an exception'); | |
26 | |
27 var xframe = doc2.createElement(name); | |
28 assert_true(xframe instanceof GeneratedConstructor, | |
29 'Created element should be x-frame instance'); | |
30 }, 'Document created by createHTMLDocument should share an existing registry'); | |
31 | |
32 | |
33 test(function() { | |
34 var doc = newHTMLDocument(); | |
35 var name = 'x-frame-1'; | |
36 | |
37 var GeneratedConstructor = doc.registerElement(name); | |
38 var doc2 = doc.implementation.createDocument(HTML_NAMESPACE, 'html', null); | |
39 assert_throws( | |
40 'NotSupportedError', | |
41 function() { doc2.registerElement(name); }, | |
42 'Exception should be thrown for custom element, ' + | |
43 'which is already registered in shared registry'); | |
44 | |
45 var xframe = doc2.createElement(name); | |
46 assert_true(xframe instanceof GeneratedConstructor, | |
47 'Created element should be x-frame instance'); | |
48 }, 'Document created by createDocument with HTML namespace should share an exist
ing registry'); | |
49 </script> | |
50 </body> | |
51 </html> | |
OLD | NEW |