Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save rockinghelvetica/b9b8972562c46b11ef1d2c88053268cd to your computer and use it in GitHub Desktop.
Save rockinghelvetica/b9b8972562c46b11ef1d2c88053268cd to your computer and use it in GitHub Desktop.
// POLYFILLS
// Event.composedPath
// Possibly normalize to add window to Safari's chain, as it does not?
(function(E, d, w) {
if(!E.composedPath) {
E.composedPath = function() {
if (this.path) {
return this.path;
}
var target = this.target;
this.path = [];
while (target.parentNode !== null) {
this.path.push(target);
target = target.parentNode;
}
this.path.push(d, w);
return this.path;
}
}
})(Event.prototype, document, window);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment