SHARE
TWEET

Untitled

a guest Jul 16th, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if (window.Element && !Element.prototype.closest) {
  2.   Element.prototype.closest =
  3.   function(s) {
  4.     const matches = (this.document || this.ownerDocument).querySelectorAll(s)
  5.     let i
  6.     let el = this;
  7.     do {
  8.       i = matches.length
  9.       while (--i >= 0 && matches.item(i) !== el) {}
  10.     } while ((i < 0) && (el = el.parentElement))
  11.     return el
  12.   }
  13. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top