Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[scoped-custom-element-registry] Broken on Safari 18.4 #609

Closed
1 of 5 tasks
MariusVatasoiu opened this issue Feb 25, 2025 · 10 comments · Fixed by #611
Closed
1 of 5 tasks

[scoped-custom-element-registry] Broken on Safari 18.4 #609

MariusVatasoiu opened this issue Feb 25, 2025 · 10 comments · Fixed by #611

Comments

@MariusVatasoiu
Copy link

MariusVatasoiu commented Feb 25, 2025

Description

Error thrown on Safari 18.4 at this line:

const shadowRoot = nativeAttachShadow.apply(this, arguments);

Example

Steps to reproduce

import "https://esm.sh/@webcomponents/scoped-custom-element-registry@0.0.9"
import { LitElement, html } from "https://esm.sh/lit"
import { ScopedElementsMixin } from "https://esm.sh/@open-wc/scoped-elements/html-element.js"

class Child extends LitElement {
  render() {
    return html`child`
  }
}

class MyComponent extends ScopedElementsMixin(LitElement) {
  static scopedElements = {
    "my-child": Child,
  }
  render() {
    return html`<my-child></my-child>`
  }
}

window.customElements.define("my-component", MyComponent)
<my-component></my-component>

Repro: playground

Expected behavior

No error is thrown

Actual behavior

Error is thrown

Version

@webcomponents/scoped-custom-element-registry@0.0.9

Browsers affected

  • Chrome
  • Firefox
  • Edge
  • Safari 18.4 (beta)
  • IE 11
@MariusVatasoiu
Copy link
Author

MariusVatasoiu commented Feb 26, 2025

I've tested the code from master branch and the problem seems to be solved. If I'm not wrong, this #581 PR from @sorvell solves the issue, so technically we just need a new release.

This WebKit/WebKit#39865 is the PR from Safari.

@justinfagnani
Copy link
Collaborator

justinfagnani commented Feb 26, 2025

@rniwa @annevk No one's filed a WebKit bug yet, but I wanted to tag you here as a heads up.

@annevk
Copy link

annevk commented Feb 26, 2025

Does someone have a more minimal test case? As far as I know Scoped Custom Element Registries is not enabled in 18.4 so I wonder why that would be the cause.

@MariusVatasoiu
Copy link
Author

MariusVatasoiu commented Feb 26, 2025

@annevk I left a repro in the first post:

https://jsfiddle.net/MariusVatasoiu/ahe4gkfs/

@annevk
Copy link

annevk commented Feb 26, 2025

I saw that, I meant without all the library code.

@sorvell
Copy link
Collaborator

sorvell commented Feb 26, 2025

Repro fails on Safari 18.4 beta: https://lit.dev/playground/#gist=86fda1412a8cde894575da93db30561f

Putting registry in the shadowRoot options appears to be bad.

@justinfagnani
Copy link
Collaborator

I fixed the issue on this end, and it'll be out with the next release shortly.

But @annevk the version of the polyfill with the problem is out in production. There will be broken sites, even after we release a fixed version here.

@rniwa
Copy link

rniwa commented Feb 26, 2025

Looks like this broke https://www.carmax.com/cars/toyota :(

@justinfagnani
Copy link
Collaborator

@rniwa We published the fix to npm. Do you have a contact at CarMax in case they need guidance on upgrading?

@annevk
Copy link

annevk commented Feb 27, 2025

The issue you fixed here we fixed in https://bugs.webkit.org/show_bug.cgi?id=286787 (I guess that hasn't made it yet into release) and is not the one that impacts CarMax I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants