Last active
August 29, 2015 14:27
-
-
Save richardkazuomiller/18ee3ca7275ddeb17dac to your computer and use it in GitHub Desktop.
Weird hack to get embedded tweets to load on (some versions of) iOS
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
<script src="/bower_components/webcomponentsjs/webcomponents.js"></script> | |
<!-- added the following script after importing webcomponents.js because Twitter | |
widgets call matches.apply(<something other than an element>) . Without it | |
the error "Can only call Element.matches on instances of Element" when trying | |
to embed a tweet on iOS Safari. | |
--> | |
<script> | |
Element.prototype._matches = Element.prototype.matches | |
Element.prototype.matches = function(element){ | |
if(!(this instanceof Element)){ | |
console.log(this) | |
console.log(arguments) | |
return false; | |
} | |
return this._matches.apply(this,arguments) | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment