53 lines
2.0 KiB
Diff
53 lines
2.0 KiB
Diff
diff --git a/es/shared/hover.mjs b/es/shared/hover.mjs
|
|
index 67b24bad56..c40589c034 100644
|
|
--- a/es/shared/hover.mjs
|
|
+++ b/es/shared/hover.mjs
|
|
@@ -49,13 +49,15 @@
|
|
hovered: false,
|
|
timers: [],
|
|
add: function add() {
|
|
- if (ctx.current.disabledHover || !ctx.current.className) return;
|
|
- if (!el.classList.contains(ctx.current.className)) {
|
|
- el.classList.add(ctx.current.className);
|
|
+ var current = ctx.current;
|
|
+ if (!current || current.disabledHover || !current.className) return;
|
|
+ if (!el.classList.contains(current.className)) {
|
|
+ el.classList.add(current.className);
|
|
}
|
|
},
|
|
remove: function remove() {
|
|
- if (ctx.current.className) el.classList.remove(ctx.current.className);
|
|
+ var current = ctx.current;
|
|
+ if (current && current.className) el.classList.remove(current.className);
|
|
},
|
|
clearTimers: function clearTimers() {
|
|
ctx.timers.forEach(function (t) {
|
|
@@ -64,21 +66,23 @@
|
|
ctx.timers = [];
|
|
},
|
|
downHandler: function downHandler() {
|
|
- if (ctx.current.disabledHover || ctx.hovered) return;
|
|
+ var current = ctx.current;
|
|
+ if (!current || current.disabledHover || ctx.hovered) return;
|
|
ctx.hovered = true;
|
|
ctx.clearTimers();
|
|
ctx.timers.push(window.setTimeout(function () {
|
|
ctx.add();
|
|
- }, ctx.current.startTime));
|
|
+ }, current.startTime));
|
|
},
|
|
upHandler: function upHandler() {
|
|
- if (ctx.current.disabledHover || !ctx.hovered) return;
|
|
+ var current = ctx.current;
|
|
+ if (!current || current.disabledHover || !ctx.hovered) return;
|
|
ctx.hovered = false;
|
|
ctx.clearTimers();
|
|
ctx.add();
|
|
ctx.timers.push(window.setTimeout(function () {
|
|
ctx.remove();
|
|
- }, ctx.current.stayTime));
|
|
+ }, current.stayTime));
|
|
},
|
|
cancelHandler: function cancelHandler() {
|
|
if (!ctx.hovered) return;
|