From fd90af50d910e659aa8df0d380424383c6c09620 Mon Sep 17 00:00:00 2001 From: "John Molakvoæ (skjnldsv)" Date: Thu, 23 May 2019 17:03:04 +0200 Subject: Add OCA.Files.Sidebar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ (skjnldsv) --- core/src/Polyfill/closest.js | 19 +++++++++++++++++++ core/src/Polyfill/index.js | 3 ++- core/src/main.js | 4 ++-- core/src/views/Login.vue | 2 +- 4 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 core/src/Polyfill/closest.js (limited to 'core/src') diff --git a/core/src/Polyfill/closest.js b/core/src/Polyfill/closest.js new file mode 100644 index 00000000000..1c608646127 --- /dev/null +++ b/core/src/Polyfill/closest.js @@ -0,0 +1,19 @@ +// https://developer.mozilla.org/en-US/docs/Web/API/Element/closest#Polyfill + +if (!Element.prototype.matches) { + Element.prototype.matches + = Element.prototype.msMatchesSelector + || Element.prototype.webkitMatchesSelector +} + +if (!Element.prototype.closest) { + Element.prototype.closest = function(s) { + var el = this + + do { + if (el.matches(s)) return el + el = el.parentElement || el.parentNode + } while (el !== null && el.nodeType === 1) + return null + } +} diff --git a/core/src/Polyfill/index.js b/core/src/Polyfill/index.js index 055ab6343a4..306c72a0777 100644 --- a/core/src/Polyfill/index.js +++ b/core/src/Polyfill/index.js @@ -1,4 +1,4 @@ -/* +/** * @copyright 2019 Christoph Wurst * * @author 2019 Christoph Wurst @@ -20,4 +20,5 @@ */ import './console' +import './closest' import './windows-phone' diff --git a/core/src/main.js b/core/src/main.js index 29c657f5db3..3f0e82df95f 100644 --- a/core/src/main.js +++ b/core/src/main.js @@ -1,4 +1,4 @@ -/* +/** * @copyright 2018 Christoph Wurst * * @author 2018 Christoph Wurst @@ -20,8 +20,8 @@ */ import $ from 'jquery' -import '@babel/polyfill' import './Polyfill/index' +import '@babel/polyfill' // If you remove the line below, tests won't pass // eslint-disable-next-line no-unused-vars diff --git a/core/src/views/Login.vue b/core/src/views/Login.vue index 08538ec2fe9..c7958aac15b 100644 --- a/core/src/views/Login.vue +++ b/core/src/views/Login.vue @@ -27,7 +27,7 @@