Monkey patching constructors in builtin class hierarchies?

Oriol _ oriol-bugzilla at
Tue Oct 24 17:14:52 UTC 2017

The problem is that DOM defines the [`Element` interface]( without a [\[Constructor\] extended attribute](

This means that `Element` can't be directly constructed. However, you can still use something like

class FooBar extends Element {
  constructor() {
    console.log("patched in Element");
    let el = document.createElement('foo-bar');
    return Object.setPrototypeOf(el, FooBar.prototype);


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list