OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <script src="../../../resources/testharness.js"></script> | |
3 <script src="../../../resources/testharnessreport.js"></script> | |
4 <body> | |
5 <script> | |
6 test(function () { | |
7 var protoA = Object.create(HTMLDivElement.prototype); | |
8 var A = document.registerElement('x-a', { | |
9 extends: 'div', prototype: protoA}); | |
10 | |
11 assert_equals( | |
12 Object.getPrototypeOf(A), HTMLDivElement, | |
13 'generated constructor prototype should be base element constructor ' + | |
14 '(extend built-in element)'); | |
15 | |
16 assert_equals( | |
17 A.__proto__, HTMLDivElement, | |
18 'Internal prototype should also be base element function object ' + | |
19 '(extend built-in element)'); | |
20 | |
21 assert_equals( | |
22 A.prototype.__proto__, HTMLDivElement.prototype, | |
23 'Internal prototype of generated constructor prototype should be ' + | |
24 'prototype of base element function object (extend built-in element)'); | |
25 | |
26 var protoB = Object.create(protoA); | |
27 var B = document.registerElement('x-b', {prototype: protoB}); | |
28 assert_equals( | |
29 Object.getPrototypeOf(B), A, | |
30 'generated constructor prototype should be base element constructor ' + | |
31 '(extend Custom Element)'); | |
32 | |
33 assert_equals( | |
34 B.__proto__, A, | |
35 'Internal prototype should also be base element function object ' + | |
36 '(extend Custom Element)'); | |
37 | |
38 assert_equals( | |
39 B.prototype.__proto__, A.prototype, | |
40 'Internal prototype of generated constructor prototype should be ' + | |
41 'prototype of base element function object (extend Custom Element)'); | |
42 }, 'generated constructor prototype property'); | |
43 </script> | |
OLD | NEW |