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 "use strict"; |
| 8 |
| 9 class Foo extends HTMLDivElement { |
| 10 static staticFunction () { return "static function called"; } |
| 11 } |
| 12 |
| 13 var customFoo = document.registerElement("custom-foo", { |
| 14 prototype: Foo.prototype, |
| 15 }); |
| 16 |
| 17 assert_equals(Object.getPrototypeOf(customFoo), Foo, |
| 18 'generated constructor prototype should be base element constructor'); |
| 19 |
| 20 assert_equals(customFoo.staticFunction(), "static function called", |
| 21 'static function should be called using inherited element'); |
| 22 |
| 23 assert_equals(Object.getPrototypeOf(customFoo).__proto__, HTMLDivElement, |
| 24 'prototype chain should have base constructor\'s prototype'); |
| 25 }, 'should inherit from passed constructor'); |
| 26 </script> |
OLD | NEW |