From 37c511b95960fc85ed4669be15ecf71ddf5a055f Mon Sep 17 00:00:00 2001 From: Dan Popescu Date: Wed, 31 May 2017 13:07:59 +0300 Subject: [PATCH 1/3] fix: do not add event listener on enabled property in ripple --- src/directives/ripple.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/directives/ripple.js b/src/directives/ripple.js index 3fe9c2a8b41..e0651a9dc51 100644 --- a/src/directives/ripple.js +++ b/src/directives/ripple.js @@ -96,7 +96,9 @@ export default { el.__qripple = ctx Object.keys(ctx).forEach(evt => { - el.addEventListener(evt, ctx[evt], false) + if (evt !== 'enabled') { + el.addEventListener(evt, ctx[evt], false) + } }) }, update (el, { value, oldValue }) { From b25c1a73699dfb0ead66b3e95097c72b512fdd2b Mon Sep 17 00:00:00 2001 From: Dan Popescu Date: Wed, 31 May 2017 13:14:52 +0300 Subject: [PATCH 2/3] fix: do not remove event listener on enabled property in ripple --- src/directives/ripple.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/directives/ripple.js b/src/directives/ripple.js index e0651a9dc51..82b5482f11f 100644 --- a/src/directives/ripple.js +++ b/src/directives/ripple.js @@ -113,7 +113,9 @@ export default { const ctx = el.__qripple Object.keys(ctx).forEach(evt => { - el.removeEventListener(evt, ctx[evt], false) + if (evt !== 'enabled') { + el.removeEventListener(evt, ctx[evt], false) + } }) delete el.__qripple } From a169fa4df223264942063ba0fa2ae1a4510041a3 Mon Sep 17 00:00:00 2001 From: Razvan Stoenescu Date: Wed, 31 May 2017 19:24:59 +0300 Subject: [PATCH 3/3] Update ripple.js --- src/directives/ripple.js | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/directives/ripple.js b/src/directives/ripple.js index 82b5482f11f..2aca5cf3216 100644 --- a/src/directives/ripple.js +++ b/src/directives/ripple.js @@ -81,24 +81,25 @@ export default { } } - const ctx = {enabled: value !== false} + const + ctx = {enabled: value !== false}, + h = {} if (Platform.is.desktop) { - ctx.mousedown = show - ctx.mouseup = hide - ctx.mouseleave = hide + h.mousedown = show + h.mouseup = hide + h.mouseleave = hide } if (Platform.has.touch) { - ctx.touchstart = show - ctx.touchend = hide - ctx.touchcancel = hide + h.touchstart = show + h.touchend = hide + h.touchcancel = hide } + ctx.h = h el.__qripple = ctx - Object.keys(ctx).forEach(evt => { - if (evt !== 'enabled') { - el.addEventListener(evt, ctx[evt], false) - } + Object.keys(h).forEach(evt => { + el.addEventListener(evt, ctx[evt], false) }) }, update (el, { value, oldValue }) { @@ -112,10 +113,8 @@ export default { } const ctx = el.__qripple - Object.keys(ctx).forEach(evt => { - if (evt !== 'enabled') { - el.removeEventListener(evt, ctx[evt], false) - } + Object.keys(ctx.h).forEach(evt => { + el.removeEventListener(evt, ctx[evt], false) }) delete el.__qripple }