4 <title>Check duplicate definition</title>
5 <meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
6 <meta name="assert" content="If there already exists a definition with the same TYPE, set ERROR to DuplicateDefinition and stop">
7 <link rel="help" href="http://www.w3.org/TR/custom-elements/#registering-custom-elements">
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">
17 var doc = newHTMLDocument();
19 doc.registerElement(name);
20 assert_throws('NotSupportedError', function() {
21 doc.registerElement(name);
22 }, 'Exception should be thrown if definition with the same type already exists');
23 }, 'Check duplicate definition');
27 var doc = newHTMLDocument();
29 doc.registerElement(name);
30 HTML5_ELEMENTS.forEach(function(tagName) {
31 assert_throws('NotSupportedError', function() {
32 doc.registerElement(name, {
35 }, 'Exception should be thrown if definition with the same type already exists');
37 }, 'Check duplicate definition. Specify constructor');
41 var doc = newHTMLDocument();
43 doc.registerElement(name, {
44 prototype: Object.create(HTMLAnchorElement.prototype),
47 HTML5_ELEMENTS.forEach(function(tagName) {
48 assert_throws('NotSupportedError', function() {
49 doc.registerElement(name, {
52 }, 'Exception should be thrown if definition with the same type already exists');
54 }, 'Check duplicate definition. Test different prototypes and extends');