Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / imported / web-platform-tests / custom-elements / registering-custom-elements / element-registration-algorithm-no-registry.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>If document has no registry NotSupportedError is thrown</title>
5 <meta name="author" title="Aleksei Yu. Semenov" href="mailto:a.semenov@unipro.ru">
6 <meta name="assert" content="If REGISTRY does not exist, set ERROR to NoRegistry and stop.">
7 <link rel="help" href="http://www.w3.org/TR/custom-elements/#dfn-element-registration-algorithm">
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 = document.implementation.createDocument(null, 'test', null);
18     assert_throws('NotSupportedError', function(){
19                       doc.registerElement('x-a');
20                   }, 'Registering valid custom element in document ' +
21                       'without registry should throw NotSupportedError');
22
23 }, 'Registering valid custom element without options in document ' +
24     'without registry should throw NotSupportedError');
25
26
27 test(function() {
28     var doc = document.implementation.createDocument(null, 'test', null);
29     var proto = Object.create(HTMLElement.prototype);
30
31     assert_throws('NotSupportedError', function(){
32                       doc.registerElement('x-b', { prototype: proto, extends: 'a'});
33                   }, 'Registering valid custom element in document ' +
34                       'without registry should throw NotSupportedError');
35
36 }, 'Registering valid custom element with options in document ' +
37     'without registry should throw NotSupportedError');
38 </script>
39 </body>
40 </html>