Skip to content

Commit 25a9b0b

Browse files
committed
MOBILE-921 quiz: Remove duplicate closest function from rebase
1 parent e4392f1 commit 25a9b0b

File tree

1 file changed

+0
-42
lines changed

1 file changed

+0
-42
lines changed

www/core/lib/util.js

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1216,48 +1216,6 @@ angular.module('mm.core')
12161216
return urls;
12171217
};
12181218

1219-
/**
1220-
* Equivalent to element.closest(). If the browser doesn't support element.closest, it will
1221-
* traverse the parents to achieve the same functionality.
1222-
* Returns the closest ancestor of the current element (or the current element itself) which matches the selector.
1223-
*
1224-
* @module mm.core
1225-
* @ngdoc method
1226-
* @name $mmUtil#closest
1227-
* @param {Object} element DOM Element.
1228-
* @param {String} selector Selector to search.
1229-
* @return {Object} Closest ancestor.
1230-
*/
1231-
self.closest = function(element, selector) {
1232-
// Try to use closest if the browser supports it.
1233-
if (typeof element.closest == 'function') {
1234-
return element.closest(selector);
1235-
}
1236-
1237-
if (!matchesFn) {
1238-
// Find the matches function supported by the browser.
1239-
['matches','webkitMatchesSelector','mozMatchesSelector','msMatchesSelector','oMatchesSelector'].some(function(fn) {
1240-
if (typeof document.body[fn] == 'function') {
1241-
matchesFn = fn;
1242-
return true;
1243-
}
1244-
return false;
1245-
});
1246-
1247-
if (!matchesFn) {
1248-
return;
1249-
}
1250-
}
1251-
1252-
// Traverse parents.
1253-
while (element) {
1254-
if (element[matchesFn](selector)) {
1255-
return element;
1256-
}
1257-
element = element.parentElement;
1258-
}
1259-
};
1260-
12611219
/**
12621220
* Returns the contents of a certain selection in a DOM element.
12631221
*

0 commit comments

Comments
 (0)