The following code returns true
.
console.log(document.createElement('script') instanceof Element);
Doing the same in an <iframe>
context returns false
:
let iframe = document.querySelector('iframe');
iframe = iframe.contentDocument || iframe.contentWindow.document;
console.log(iframe.createElement('script') instanceof Element);
Why is that?