4 <title>If prototype has a non-configurable property named constructor, Document.registerElement() throws NotSupportedError</title>
5 <meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
6 <meta name="assert" content="If PROTOTYPE has a non-configurable property named constructor, throw a NotSupportedError and stop">
7 <link rel="help" href="http://www.w3.org/TR/custom-elements/#instantiating-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();
18 var proto = Object.create(HTMLElement.prototype);
19 Object.defineProperty(proto, 'constructor', {configurable: false});
20 assert_throws('NotSupportedError', function() {
21 doc.registerElement('x-a', {prototype: proto});
22 }, 'Exception should be thrown in case of attempt to register element ' +
23 'with a non-configurable property named constructor');
24 }, 'Test Document.registerElement() throws NotSupportedError ' +
25 'if prototype has a non-configurable property named constructor');
29 var doc = newHTMLDocument();
30 var proto = Object.create(HTMLElement.prototype);
31 Object.defineProperty(proto, 'constructor', {configurable: true});
33 doc.registerElement('x-b', {prototype: proto});
35 assert_unreached('Exception should not be thrown in case of attempt to register ' +
36 'element with a configurable property named constructor');
38 }, 'Test Document.registerElement() accepts prototype with a configurable ' +
39 'property named constructor without throwing errors');