Bug 195556

Summary: Unable to extend the DocumentFragment class
Product: WebKit Reporter: Andrea Giammarchi <andrea.giammarchi>
Component: DOMAssignee: Nobody <webkit-unassigned>
Status: RESOLVED CONFIGURATION CHANGED    
Severity: Normal CC: ashvayka
Priority: P2    
Version: Safari Technology Preview   
Hardware: Mac   
OS: macOS 10.14   
See Also: https://bugs.webkit.org/show_bug.cgi?id=174313

Description Andrea Giammarchi 2019-03-11 07:59:15 PDT
The following code will fail the assertion that would, otherwise, pass in every other browser that implements classes.

(function () {'use strict';
  class WaitWhat extends DocumentFragment {}
  console.assert(
    (new WaitWhat) instanceof WaitWhat,
    `any instance of a DocumentFragment extend fails`
  );
}());

This is true even through Reflect.construct

(function () {'use strict';
  class WaitWhat extends DocumentFragment {}
  console.assert(
    Reflect.construct(DocumentFragment, [], WaitWhat) instanceof WaitWhat,
    `any instance of a DocumentFragment extend fails`
  );
}());

The expected behavior is that it is possible to extend the DocumentFragment as any other built-in class.
Comment 1 Alexey Shvayka 2020-04-17 14:45:14 PDT
As of r256716, extending DocumentFragment (as well as other DOM constructors) works as expected.