3 ms·
> This is just a better way of doing DOM scripting Better than what? > enhancing without waiting for Document Ready event Instead you wait for `connectedCall
by troupo 3y ago
> This is just a better way of doing DOM scripting
Better than what?
> enhancing without waiting for Document Ready event
Instead you wait for `connectedCallback`
> and having more freedom when to load the dynamic bits.
You literally have no freedom over that. Web components are rendered the moment they are added to the page, and you have no control over that. So if something dynamic is happening in your `connectedCallback`, boom, our dynamic bits are loaded whether you want them or not.
- gryzzly 3y agobetter than centralized `$('.special-element').applyDynamicBehaviour()` you control when the script is loaded right? connectedCallback happens per component, not in a centralised manner – so you write the logic for what happens in a place where it happens