diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2016-11-25 17:21:50 +0300 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2016-11-30 20:06:47 +0300 |
commit | 6789befbf6b0578718b0e461c60326cd97dc8640 (patch) | |
tree | 8e9dcbbb57f3cae2bfe78b6a58037eaba165e690 /app/assets/javascripts/extensions/element.js.es6 | |
parent | cb9cee545a5952ed35ccd95e8cd4abe228f09a7b (diff) |
Fixes after review
Fix pipelines tests
Fix rubocop
Diffstat (limited to 'app/assets/javascripts/extensions/element.js.es6')
-rw-r--r-- | app/assets/javascripts/extensions/element.js.es6 | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/app/assets/javascripts/extensions/element.js.es6 b/app/assets/javascripts/extensions/element.js.es6 index 0abe8644f30..328cc57dca0 100644 --- a/app/assets/javascripts/extensions/element.js.es6 +++ b/app/assets/javascripts/extensions/element.js.es6 @@ -1,19 +1,11 @@ /* global Element */ -/* eslint-disable consistent-return, max-len */ +/* eslint-disable consistent-return, max-len, no-empty, no-plusplus, func-names */ Element.prototype.closest = Element.prototype.closest || function closest(selector, selectedElement = this) { if (!selectedElement) return; return selectedElement.matches(selector) ? selectedElement : Element.prototype.closest(selector, selectedElement.parentElement); }; -/* eslint-disable */ -/** - * .matches polyfill from mdn - * https://developer.mozilla.org/en-US/docs/Web/API/Element/matches - * - * .matches is used in our code. - * In order to run the tests in Phantomjs we need this polyfill - */ if (!Element.prototype.matches) { Element.prototype.matches = Element.prototype.matchesSelector || @@ -22,8 +14,8 @@ if (!Element.prototype.matches) { Element.prototype.oMatchesSelector || Element.prototype.webkitMatchesSelector || function (s) { - var matches = (this.document || this.ownerDocument).querySelectorAll(s), - i = matches.length; + const matches = (this.document || this.ownerDocument).querySelectorAll(s); + let i = matches.length; while (--i >= 0 && matches.item(i) !== this) {} return i > -1; }; |