OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <script src="../../../resources/testharness.js"></script> |
3 <head> | 3 <script src="../../../resources/testharnessreport.js"></script> |
4 <title>New document without browsing context must not have a registry</title> | |
5 <meta name="author" title="Aleksei Yu. Semenov" href="mailto:a.semenov@unipro.ru
"> | |
6 <meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru"> | |
7 <meta name="assert" content="In all other cases, new documents must not have a r
egistry."> | |
8 <link rel="help" href="http://www.w3.org/TR/custom-elements/#creating-and-passin
g-registries"> | |
9 <script src="../../../../resources/testharness.js"></script> | |
10 <script src="../../../../resources/testharnessreport.js"></script> | |
11 <script src="../testcommon.js"></script> | |
12 <link rel="stylesheet" href="../../../../resources/testharness.css"> | |
13 </head> | |
14 <body> | |
15 <div id="log"></div> | |
16 <script> | 4 <script> |
17 test(function() { | 5 test(function() { |
18 var doc = document.implementation.createDocument(null, 'test', null); | 6 var doc = document.implementation.createDocument(null, 'test', null); |
19 assert_throws( | 7 assert_throws( |
20 'NotSupportedError', | 8 'NotSupportedError', |
21 function() { doc.registerElement('x-element'); }, | 9 function() { doc.registerElement('x-element'); }, |
22 'Registering valid custom element in a document ' + | 10 'Registering valid custom element in a document ' + |
23 'without registry should fail'); | 11 'without registry should fail'); |
24 }, 'Document of type other than HTML, not loaded into browsing context, must not
have a registry'); | 12 }, 'Document of type other than HTML, not loaded into browsing context, must not
have a registry'); |
25 | 13 |
26 async_test(function(t) { | 14 async_test(function(t) { |
27 var request = new XMLHttpRequest(); | 15 var request = new XMLHttpRequest(); |
28 request.onreadystatechange = t.step_func(function() { | 16 request.onreadystatechange = t.step_func(function() { |
29 if (request.readyState == 4){ | 17 if (request.readyState == 4) { |
30 assert_equals(200, request.status, 'Test document is not loaded corr
ectly'); | 18 assert_equals(request.status, 200, 'Test document is not loaded corr
ectly'); |
31 var doc = request.response; | 19 var doc = request.response; |
32 assert_true(doc instanceof HTMLDocument, | 20 assert_true(doc instanceof HTMLDocument, |
33 'XMLHttpRequest\'s asynchronous response should be HTML document
'); | 21 'XMLHttpRequest\'s asynchronous response should be HTML document
'); |
34 assert_throws( | 22 assert_throws( |
35 'NotSupportedError', | 23 'NotSupportedError', |
36 function() { doc.registerElement('x-element'); }, | 24 function() { doc.registerElement('x-element'); }, |
37 'Registering valid custom element in ' + | 25 'Registering valid custom element in ' + |
38 'an XMLHttpRequest\'s response document should fail'); | 26 'an XMLHttpRequest\'s response document should fail'); |
39 t.done(); | 27 t.done(); |
40 } | 28 } |
41 }); | 29 }); |
42 | 30 |
43 request.open('GET', '../resources/blank.html', true); | 31 request.open('GET', 'resources/blank.html', true); |
44 request.responseType = 'document'; | 32 request.responseType = 'document'; |
45 request.send(); | 33 request.send(); |
46 }, 'XMLHttpRequest\'s asynchronous response HTML document must not have a regist
ry'); | 34 }, 'XMLHttpRequest\'s asynchronous response HTML document must not have a regist
ry'); |
47 </script> | 35 </script> |
48 </body> | 36 </body> |
49 </html> | 37 </html> |
OLD | NEW |