Closed KillerCodeMonkey closed 4 years ago
I appreciate the effort here, but instanceof
won't work in the case of ShadowRoot
for older versions of IE since IE doesn't support anything shadow-DOM related.
maybe just check if it is IE or if there is ShadowRoot?
I just added a special case with toString
.
One question: You have var hasShadowDomSupport = 'getRootNode' in window.Node.prototype
and additionally in } else if (currentParent.toString() === '[object ShadowRoot]') {
a check about hasShadowDomSupport
. Isn't it obsolete when checking for '[object ShadowRoot]'
. Why should a browser not supporting shadowDom have a dom node of ShadowRoot?
@KillerCodeMonkey
Isn't it obsolete when checking for '[object ShadowRoot]'. Why should a browser not supporting shadowDom have a dom node of ShadowRoot?
You're right about this. I'm kinda flying blind here since I don't really know a reliable way to test in IE. I'll have to take a 2nd look at all this, but at least it won't break anything.
It is strange to use
({}).toString.call(thing)
instead just useinstanceof
and for the generic object check, use.toString()
in this case