You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This has been covered in many closed issues, as far back as #1168, but there may be some new developments here that make a solution possible.
Babel has a PR in flight that enables extending native built-ins (including HTMLElement, which is my primary concern): babel/babel#7020
The technique is to wrap the native class with a class whose constructor calls Reflect.construct if it exists, ensuring that new.target is set properly. Babel's solution tries to statically detect if any extendable built-ins are subclassed in order to trigger wrapping them. It would also be useful to manually configure built-ins to wrap.
This at least lets downlevel output work properly on environments with extendable native classes. In environments without the extendable native classes, polyfills (like the Custom Elements polyfill) can possibly add them.
The text was updated successfully, but these errors were encountered:
This has been covered in many closed issues, as far back as #1168, but there may be some new developments here that make a solution possible.
Babel has a PR in flight that enables extending native built-ins (including HTMLElement, which is my primary concern): babel/babel#7020
The technique is to wrap the native class with a class whose constructor calls
Reflect.construct
if it exists, ensuring thatnew.target
is set properly. Babel's solution tries to statically detect if any extendable built-ins are subclassed in order to trigger wrapping them. It would also be useful to manually configure built-ins to wrap.This at least lets downlevel output work properly on environments with extendable native classes. In environments without the extendable native classes, polyfills (like the Custom Elements polyfill) can possibly add them.
The text was updated successfully, but these errors were encountered: