From bf51490e468204965d15c6fdb451950c1fdce5fe Mon Sep 17 00:00:00 2001 From: Alex Pott <alex.a.pott@googlemail.com> Date: Thu, 24 Oct 2019 09:25:34 +0100 Subject: [PATCH] Issue #3089752 by bnjmnm, zrpnr: Follow-up to #3074267 Refactor use of classList in quickedit for browser compatibility --- core/modules/quickedit/js/views/EntityToolbarView.es6.js | 4 ++-- core/modules/quickedit/js/views/EntityToolbarView.js | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/core/modules/quickedit/js/views/EntityToolbarView.es6.js b/core/modules/quickedit/js/views/EntityToolbarView.es6.js index 9bc2d9c8852a..eece46b5a11e 100644 --- a/core/modules/quickedit/js/views/EntityToolbarView.es6.js +++ b/core/modules/quickedit/js/views/EntityToolbarView.es6.js @@ -299,9 +299,9 @@ function refinePopper(data) { // Determine if the pointer should be on the top or bottom. const isBelow = data.offsets.popper.top > data.offsets.reference.top; - data.instance.popper.classList.toggle( + const classListMethod = isBelow ? 'add' : 'remove'; + data.instance.popper.classList[classListMethod]( 'quickedit-toolbar-pointer-top', - isBelow, ); // Don't position the toolbar past the first or last editable field if // the entity is the target. diff --git a/core/modules/quickedit/js/views/EntityToolbarView.js b/core/modules/quickedit/js/views/EntityToolbarView.js index 147990fcb7be..30dd7fa2daf9 100644 --- a/core/modules/quickedit/js/views/EntityToolbarView.js +++ b/core/modules/quickedit/js/views/EntityToolbarView.js @@ -165,7 +165,8 @@ function refinePopper(data) { var isBelow = data.offsets.popper.top > data.offsets.reference.top; - data.instance.popper.classList.toggle('quickedit-toolbar-pointer-top', isBelow); + var classListMethod = isBelow ? 'add' : 'remove'; + data.instance.popper.classList[classListMethod]('quickedit-toolbar-pointer-top'); if (that.$entity[0] === data.instance.reference) { var $field = that.$entity.find('.quickedit-editable').eq(isBelow ? -1 : 0); -- GitLab