Created
May 4, 2019 09:23
-
-
Save WebCulT/8ea9ab7bcd62e41897928f2138d3dd90 to your computer and use it in GitHub Desktop.
Polyfill for IE11
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
if (!Element.prototype.closest) { | |
// реализуем | |
Element.prototype.closest = function(css) { | |
var node = this; | |
while (node) { | |
if (node.matches(css)) return node; | |
else node = node.parentElement; | |
} | |
return null; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment