summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/custom-elements/v0/registering/element-registration-algorithm-no-registry.html
blob: 6e9c20be30cb72baed29c12c43112aeb85668e40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<!DOCTYPE html>
<html>
<head>
<title>If document has no registry NotSupportedError is thrown</title>
<meta name="author" title="Aleksei Yu. Semenov" href="mailto:a.semenov@unipro.ru">
<meta name="assert" content="If REGISTRY does not exist, set ERROR to NoRegistry and stop.">
<link rel="help" href="http://www.w3.org/TR/custom-elements/#dfn-element-registration-algorithm">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../testcommon.js"></script>
</head>
<body>
<div id="log"></div>
<script>
test(function() {
    var doc = document.implementation.createDocument(null, 'test', null);
    assert_throws('NotSupportedError', function(){
                      doc.registerElement('x-a');
                  }, 'Registering valid custom element in document ' +
                      'without registry should throw NotSupportedError');

}, 'Registering valid custom element without options in document ' +
    'without registry should throw NotSupportedError');


test(function() {
    var doc = document.implementation.createDocument(null, 'test', null);
    var proto = Object.create(HTMLElement.prototype);

    assert_throws('NotSupportedError', function(){
                      doc.registerElement('x-b', { prototype: proto, extends: 'a'});
                  }, 'Registering valid custom element in document ' +
                      'without registry should throw NotSupportedError');

}, 'Registering valid custom element with options in document ' +
    'without registry should throw NotSupportedError');
</script>
</body>
</html>