Closed emkajeej closed 3 years ago
Changing the var makes sense. But for the shadow root, what happens when you don't pass in a selector at all? That should fallback to the default document.body
It already falls back to document.body I think if you don't pass a selector. It's just IE that fails to do so, so if IE is not of your concern than you can leave it blank and it will fall back to ShadowRoot.
Actually looking at L266 and beyond, I'm not sure why IE doesn't just skip to the
Edited because I read your post correctly this time :)
IE fails because it's only checked if the passed value is a ShadowRoot instance, but not wether or not the browser supports ShadowRoot at all. So IE will flake out of the else
, ie document.body
.instanceof
check as ShadowRoot
is unknown to it.
Explicitly passing document.body or an HTMLElement fixes it for all in any case.
Fix from @AStoker in https://www.npmjs.com/package/toastify-js/v/1.11.1
Using this library in IE11 no longer work out of the box.
line 127 etc:
Replacing
const
withvar
fixes this.Also note that
ShadowRoot
(line 266) is not supported in IE11. Therefore theselector
parameter needs to be passed when calling a Toastify: