getSuperMethod() relies on Function.name (which doesn't survive minification) to walk the prototype chain:
|
export function getSuperMethod (obj, currentMethod) { |
|
return getSuperMember(obj, currentMethod.name, currentMethod); |
|
} |
The shadow plugin's attachShadow() function is passed to getSuperMethod(), which internally does currentMethod.name to find HTMLElement.prototype.attachShadow:
|
const _attachShadow = getSuperMethod(this, attachShadow); |
esm.sh minifies attachShadow → h, so h.name === "h". The lookup for attachShadow up the prototype chain fails, getSuperMethod() returns undefined, and the shadow root is never created:
|
return (this[shadowRoot] = null); |
As a result, for example, none of the color elements work via esm.sh.
getSuperMethod()relies onFunction.name(which doesn't survive minification) to walk the prototype chain:element/src/util/super.js
Lines 93 to 95 in 6e22d72
The shadow plugin's
attachShadow()function is passed togetSuperMethod(), which internally doescurrentMethod.nameto findHTMLElement.prototype.attachShadow:element/src/plugins/shadow/index.js
Line 19 in 6e22d72
esm.shminifiesattachShadow→h, soh.name === "h". The lookup forattachShadowup the prototype chain fails,getSuperMethod()returnsundefined, and the shadow root is never created:element/src/plugins/shadow/index.js
Line 23 in 6e22d72
As a result, for example, none of the color elements work via
esm.sh.