Skip to content

Instantly share code, notes, and snippets.

@nabilfreeman
Created October 7, 2014 22:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nabilfreeman/bd0d413993ddfc964c18 to your computer and use it in GitHub Desktop.
Save nabilfreeman/bd0d413993ddfc964c18 to your computer and use it in GitHub Desktop.
instanceof Element returns false
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