aboutsummaryrefslogtreecommitdiff
path: root/node_modules/delegate/src/closest.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/delegate/src/closest.js')
-rw-r--r--node_modules/delegate/src/closest.js33
1 files changed, 0 insertions, 33 deletions
diff --git a/node_modules/delegate/src/closest.js b/node_modules/delegate/src/closest.js
deleted file mode 100644
index 842ea074..00000000
--- a/node_modules/delegate/src/closest.js
+++ /dev/null
@@ -1,33 +0,0 @@
-var DOCUMENT_NODE_TYPE = 9;
-
-/**
- * A polyfill for Element.matches()
- */
-if (typeof Element !== 'undefined' && !Element.prototype.matches) {
- var proto = Element.prototype;
-
- proto.matches = proto.matchesSelector ||
- proto.mozMatchesSelector ||
- proto.msMatchesSelector ||
- proto.oMatchesSelector ||
- proto.webkitMatchesSelector;
-}
-
-/**
- * Finds the closest parent that matches a selector.
- *
- * @param {Element} element
- * @param {String} selector
- * @return {Function}
- */
-function closest (element, selector) {
- while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
- if (typeof element.matches === 'function' &&
- element.matches(selector)) {
- return element;
- }
- element = element.parentNode;
- }
-}
-
-module.exports = closest;