When the component is loaded before the DOM is fully loaded, it will defer its connectedCallback to the next readystatechange event by attaching an event listener and returning early, but when the DOM has already loaded, it will jump over the early return and do its initialisation as usual.
This works in all three cases:
When the component is defined before the DOM finishes loading (via the event handler)
When the component is defined after the DOM finishes loading (skipping the early return)
When the component is inserted via javascript (again, skipping the early return)
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
That isn't my work-around though. Here's what that should look like:
When the component is loaded before the DOM is fully loaded, it will defer its
connectedCallbackto the nextreadystatechangeevent by attaching an event listener and returning early, but when the DOM has already loaded, it will jump over the early return and do its initialisation as usual.This works in all three cases: