Index: LayoutTests/fast/dom/custom/inherited-prototype.html |
diff --git a/LayoutTests/fast/dom/custom/inherited-prototype.html b/LayoutTests/fast/dom/custom/inherited-prototype.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c95f4769b7fc6b306863e43f6d561e92519c4f23 |
--- /dev/null |
+++ b/LayoutTests/fast/dom/custom/inherited-prototype.html |
@@ -0,0 +1,43 @@ |
+<!DOCTYPE html> |
+<script src="../../../resources/testharness.js"></script> |
+<script src="../../../resources/testharnessreport.js"></script> |
+<body> |
+<script> |
+test(function () { |
+ var protoA = Object.create(HTMLDivElement.prototype); |
+ var A = document.registerElement('x-a', { |
+ extends: 'div', prototype: protoA}); |
+ |
+ assert_equals( |
+ Object.getPrototypeOf(A), HTMLDivElement, |
+ 'generated constructor prototype should be base element constructor ' + |
+ '(extend built-in element)'); |
+ |
+ assert_equals( |
+ A.__proto__, HTMLDivElement, |
+ 'Internal prototype should also be base element function object ' + |
+ '(extend built-in element)'); |
+ |
+ assert_equals( |
+ A.prototype.__proto__, HTMLDivElement.prototype, |
+ 'Internal prototype of generated constructor prototype should be ' + |
+ 'prototype of base element function object (extend built-in element)'); |
+ |
+ var protoB = Object.create(protoA); |
+ var B = document.registerElement('x-b', {prototype: protoB}); |
+ assert_equals( |
+ Object.getPrototypeOf(B), A, |
+ 'generated constructor prototype should be base element constructor ' + |
+ '(extend Custom Element)'); |
+ |
+ assert_equals( |
+ B.__proto__, A, |
+ 'Internal prototype should also be base element function object ' + |
+ '(extend Custom Element)'); |
+ |
+ assert_equals( |
+ B.prototype.__proto__, A.prototype, |
+ 'Internal prototype of generated constructor prototype should be ' + |
+ 'prototype of base element function object (extend Custom Element)'); |
+}, 'generated constructor prototype property'); |
+</script> |