diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2016-11-29 13:35:53 +0300 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2016-11-30 20:06:48 +0300 |
commit | aa2d6eec9e36acdff679d3a5ef17db0780f51447 (patch) | |
tree | bc2964489195949bdc93bab2a356f8e4ae4033a7 /app/assets/javascripts/extensions | |
parent | 6789befbf6b0578718b0e461c60326cd97dc8640 (diff) |
Improvements after review
Diffstat (limited to 'app/assets/javascripts/extensions')
-rw-r--r-- | app/assets/javascripts/extensions/element.js.es6 | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/app/assets/javascripts/extensions/element.js.es6 b/app/assets/javascripts/extensions/element.js.es6 index 328cc57dca0..3f12ad9ff9f 100644 --- a/app/assets/javascripts/extensions/element.js.es6 +++ b/app/assets/javascripts/extensions/element.js.es6 @@ -6,17 +6,15 @@ Element.prototype.closest = Element.prototype.closest || function closest(select return selectedElement.matches(selector) ? selectedElement : Element.prototype.closest(selector, selectedElement.parentElement); }; -if (!Element.prototype.matches) { - Element.prototype.matches = - Element.prototype.matchesSelector || - Element.prototype.mozMatchesSelector || - Element.prototype.msMatchesSelector || - Element.prototype.oMatchesSelector || - Element.prototype.webkitMatchesSelector || - function (s) { - const matches = (this.document || this.ownerDocument).querySelectorAll(s); - let i = matches.length; - while (--i >= 0 && matches.item(i) !== this) {} - return i > -1; - }; -} +Element.prototype.matches = Element.prototype.matches || + Element.prototype.matchesSelector || + Element.prototype.mozMatchesSelector || + Element.prototype.msMatchesSelector || + Element.prototype.oMatchesSelector || + Element.prototype.webkitMatchesSelector || + function (s) { + const matches = (this.document || this.ownerDocument).querySelectorAll(s); + let i = matches.length; + while (--i >= 0 && matches.item(i) !== this) {} + return i > -1; + }; |