Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(336)

Side by Side Diff: LayoutTests/imported/web-platform-tests/custom-elements/creating-and-passing-registries/share-registry-create-document.html

Issue 560893005: First checked-in import of the W3C's test suites. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: add new expectations for newly failing w3c tests Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 <link rel="stylesheet" href="../../../../resources/testharness.css">
12 </head>
13 <body>
14 <div id="log"></div>
15 <script>
16 test(function() {
17 var doc = newHTMLDocument();
18 var name = 'x-frame';
19
20 var GeneratedConstructor = doc.registerElement(name);
21 var doc2 = doc.implementation.createHTMLDocument('Document 2');
22 assert_throws(
23 'NotSupportedError',
24 function() { doc2.registerElement(name); },
25 'Registering a custom element type name that is already registered in a shared ' +
26 'registry should throw an exception');
27
28 var xframe = doc2.createElement(name);
29 assert_true(xframe instanceof GeneratedConstructor,
30 'Created element should be x-frame instance');
31 }, 'Document created by createHTMLDocument should share an existing registry');
32
33
34 test(function() {
35 var doc = newHTMLDocument();
36 var name = 'x-frame-1';
37
38 var GeneratedConstructor = doc.registerElement(name);
39 var doc2 = doc.implementation.createDocument(HTML_NAMESPACE, 'html', null);
40 assert_throws(
41 'NotSupportedError',
42 function() { doc2.registerElement(name); },
43 'Exception should be thrown for custom element, ' +
44 'which is already registered in shared registry');
45
46 var xframe = doc2.createElement(name);
47 assert_true(xframe instanceof GeneratedConstructor,
48 'Created element should be x-frame instance');
49 }, 'Document created by createDocument with HTML namespace should share an exist ing registry');
50 </script>
51 </body>
52 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698