You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The MutationObserver strategy fails when the script defining elements is included inside the <head> tag, without using defer or async on the script tag. The error is:
Uncaught TypeError: Failed to execute 'observe' on 'MutationObserver': parameter 1 is not of type 'Node'.
It would be possible to get around this by calling Remount.define inside a jQuery $().ready event handler or equivalent native JS, which would ensure that document.body exists.
It would be nice if this limitation were documented. Even better if it were handled by remount itself.
The text was updated successfully, but these errors were encountered:
The MutationObserver strategy fails when the script defining elements is included inside the
<head>
tag, without usingdefer
orasync
on the script tag. The error is:The site of the error is here:
remount/src/strategies/mutation_observer.js
Lines 76 to 79 in 8bd440e
The cause is that, inside
<head>
where the script is being evaluated,document.body
does not yet exist.Here is a repl.it link demonstrating the issue: https://repl.it/@EvanShaw2/Remount-MutationObserver-strategy-issue (This code forces all browsers to use the MutationObserver strategy, even if they support custom elements.)
It would be possible to get around this by calling
Remount.define
inside a jQuery$().ready
event handler or equivalent native JS, which would ensure thatdocument.body
exists.It would be nice if this limitation were documented. Even better if it were handled by remount itself.
The text was updated successfully, but these errors were encountered: