martok / palefill

Inject Polyfills for various web technologies into pages requiring them
https://martok.github.io/palefill/
Mozilla Public License 2.0
81 stars 9 forks source link

IKEA - problem with injected customElements #31

Closed UCyborg closed 2 years ago

UCyborg commented 2 years ago

A web site with interesting problem was brought up on Pale Moon forum.

https://www.ikea.com/gb/en/search/?q=pillows

After adding the rule in /lib/builtin-rules.js to add customElements to www.ikea.com, the following error shows up in the console:

Error: Failed to construct a custom element: The constructor was not registered with customElements.

martok commented 2 years ago

Turns out that even has a comment in the polyfill's source. https://github.com/webcomponents/polyfills/blob/master/packages/custom-elements/ts_src/Patch/HTMLElement.ts#L20 As far as I can tell, we have new.target on all platforms, so we can just use that.

UCyborg commented 2 years ago

Looks like Custom Elements aren't enough for IKEA. Rendering on the search page remains incomplete along with the message about outdated browser.

martok commented 2 years ago

I see TypeError: Function.prototype.toString called on incompatible object for what is basically Function.toString.call(new Proxy(document.addEventListener, {})). This used to be forbidden but was apparently changed (for example, the ancient german translation of MDN still mentions it).

This was Bugzilla 1440468, I think it makes more sense to fix this in UXP than here, even if it takes longer since it looks like I might just miss 31.2...


While it's nice to fix this, that's not all. IKEA does the right thing and actually switches modes based on what they need (not the UA)... it's possible to bypass these checks, but the experience honestly isn't great with all the CSS that isn't supported...