Bug 195556 - Unable to extend the DocumentFragment class
Summary: Unable to extend the DocumentFragment class
Status: RESOLVED CONFIGURATION CHANGED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: Safari Technology Preview
Hardware: Mac macOS 10.14
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-03-11 07:59 PDT by Andrea Giammarchi
Modified: 2020-04-17 14:45 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.