glimmer-vm
glimmer-vm copied to clipboard
IE11 - Error when element's innerHTML is changed before glimmer tries to modify it
IE bug report here: https://connect.microsoft.com/IE/feedbackdetail/view/944330/invalid-argument-error-when-changing-nodevalue-of-a-text-node-removed-by-setting-innerhtml-on-an-ancestor
Basically, if an element's innerHTML is replaced before glimmer tries to insert text (due to the element having handlebars markup inside of it), IE11 errors out.
The line that errors is here: https://github.com/tildeio/glimmer/blob/3437ee92284317f3bf32b661cb1089e2915f7213/packages/glimmer-runtime/lib/upsert.ts#L75
Wrapping that line in a try/catch seems to work and give the same functionality as in Chrome (the original innerHTML modification takes precedent, because glimmer is modifying an non-existent node).
EDIT: Wrapping it in a try/catch, and returning false in the catch does not work, but returning true does.
I recently ran into this same issue, in my case I was able to fix it by removing some jQuery code that was also trying to modify the same element (FWIW, not my jQuery code, and I was glad to have an excuse to remove it.)
Just wanted to point out that this seems likely to happen in situations where some external (to Ember/Glimmer) JavaScript is modifying the DOM as well. I do think that if IE11 is a supported browser, the fix described seems like it should be viable and should be applied (assuming no weird side effects from doing so).
I'm doing some issue gardening 🌱🌿 🌷 and came upon this issue. Since it's quite old I just wanted to ask if this is still relevant? If it isn't, maybe we can close this issue?
By closing some old issues we reduce the list of open issues to a more manageable set.
Ie11 is no longer supported, no i think we can close this?