diff options
Diffstat (limited to 'app/assets/javascripts/extensions')
-rw-r--r-- | app/assets/javascripts/extensions/array.js | 1 | ||||
-rw-r--r-- | app/assets/javascripts/extensions/element.js.es6 | 7 | ||||
-rw-r--r-- | app/assets/javascripts/extensions/jquery.js | 1 |
3 files changed, 9 insertions, 0 deletions
diff --git a/app/assets/javascripts/extensions/array.js b/app/assets/javascripts/extensions/array.js index 24f9e00097c..4c9e219aa43 100644 --- a/app/assets/javascripts/extensions/array.js +++ b/app/assets/javascripts/extensions/array.js @@ -1,3 +1,4 @@ +/* eslint-disable */ Array.prototype.first = function() { return this[0]; } diff --git a/app/assets/javascripts/extensions/element.js.es6 b/app/assets/javascripts/extensions/element.js.es6 new file mode 100644 index 00000000000..c74fc9ad074 --- /dev/null +++ b/app/assets/javascripts/extensions/element.js.es6 @@ -0,0 +1,7 @@ +/* eslint-disable */ +Element.prototype.matches = Element.prototype.matches || Element.prototype.msMatches; + +Element.prototype.closest = function closest(selector, selectedElement = this) { + if (!selectedElement) return; + return selectedElement.matches(selector) ? selectedElement : Element.prototype.closest(selector, selectedElement.parentElement); +}; diff --git a/app/assets/javascripts/extensions/jquery.js b/app/assets/javascripts/extensions/jquery.js index 4978e24949c..623a80b7053 100644 --- a/app/assets/javascripts/extensions/jquery.js +++ b/app/assets/javascripts/extensions/jquery.js @@ -1,3 +1,4 @@ +/* eslint-disable */ // Disable an element and add the 'disabled' Bootstrap class (function() { $.fn.extend({ |