Quantcast
Channel: How to scope querySelector to component in Svelte? - Stack Overflow
Browsing index pages (3 articles)

How to scope querySelector to component in Svelte?

I have this component, andI would like to do some manipulations on its children elements in ways that are not feasible in a state-driven way. So I would like to use a statement and a querySelector in...

View Article


Answer by Stephane Vanraes for How to scope querySelector to component in...

You can use bind:this to assign an element to a variable<script> let wrapper;</script><div bind:this="{wrapper}"></div>now you can use wrapper as if you would have gotten it...

View Article


Answer by Vikash Madhow for How to scope querySelector to component in Svelte?

Building on the answer by Stephane Vanraes, use bind:this to bind the top-level element of your component to a variable and then use querySelector and querySelectorAll on that root element. For...

View Article
Browsing index pages (3 articles)


Latest Images