Skip to content

Instantly share code, notes, and snippets.

@rockinghelvetica
Created May 4, 2018 22:01
Show Gist options
  • Save rockinghelvetica/00b9f7b5c97a16d3de75ba99192ff05c to your computer and use it in GitHub Desktop.
Save rockinghelvetica/00b9f7b5c97a16d3de75ba99192ff05c 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