Created
October 7, 2014 22:48
-
-
Save nabilfreeman/bd0d413993ddfc964c18 to your computer and use it in GitHub Desktop.
instanceof Element returns false
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I had a problem with a site my widget was embedded on. | |
var el = document.createElement("div"); | |
el instanceof Element; | |
>>> false | |
wat... | |
every other site on the planet returned true. | |
It turns out the culprit was Mootools v1.11. | |
Here is an example: | |
Mootools 1.11 (this breaks): | |
http://jsfiddle.net/f36kT/6/ | |
Mootools 1.2.6 (this works): | |
http://jsfiddle.net/f36kT/7/ | |
In case those links do not work, Mootools overwrites the Element global object with its own variable. | |
This is a shitty idea, but whatever. | |
It looks like something was very broken and they fixed it post-v1.11. | |
So the solution...... | |
UPDATE MOOTOOLS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment