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

support for shadow root as container #597

Open
patrickkmatias opened this issue Jul 26, 2023 · 1 comment
Open

support for shadow root as container #597

patrickkmatias opened this issue Jul 26, 2023 · 1 comment

Comments

@patrickkmatias
Copy link

Is your support request related to a problem? Please describe.
I'm creating a webapp using web components and I'm trying to lazy load a video that's inside my component, which has a shadow root, and to access its elements it's only possible accessing first the shadowRoot prop. and then selecting it with querySelector() for example.

So I try to use a shadow root prop. as value for the container property of the options object like this:

const lazy = new LazyLoad({
      container: document
        .querySelector("home-page")
        .shadowRoot.querySelector("contact-section").shadowRoot,
    });

and it throws the following error:

TypeError: Failed to construct 'IntersectionObserver': Failed to read the 'root' property from 'IntersectionObserverInit': The provided value is not of type '(Document or Element)'.
    at lazyload.min.js:1:7380
    at new En (lazyload.min.js:1:7543)
    at main.js:20:18

trying to select contact-section without shadowRoot won't select any element

To Reproduce
Create a web component and use it as container for the LazyLoad class, through the options argument.

@sovetski
Copy link

Any news on this subject? In my shadow DOM component the lazy load does not work too...

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

No branches or pull requests

2 participants