From 4ff3b6a978cb782ed2ac76ca0a33cf3192dc33a6 Mon Sep 17 00:00:00 2001 From: Clement Ho Date: Tue, 29 Aug 2017 17:16:08 -0500 Subject: jQueryify feature_highlight file --- app/assets/javascripts/feature_highlight/feature_highlight.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/feature_highlight/feature_highlight.js b/app/assets/javascripts/feature_highlight/feature_highlight.js index c6b77e43bcd..0dd18405e86 100644 --- a/app/assets/javascripts/feature_highlight/feature_highlight.js +++ b/app/assets/javascripts/feature_highlight/feature_highlight.js @@ -32,7 +32,7 @@ export const dismiss = function dismiss(cookieId) { }; export const mouseleave = function mouseleave() { - if (!document.querySelector('.popover:hover')) { + if (!$('.popover:hover').length > 0) { const $featureHighlight = $(this); hidePopover.call($featureHighlight); } @@ -43,8 +43,8 @@ export const mouseenter = function mouseenter() { const showedPopover = showPopover.call($featureHighlight); if (showedPopover) { - document.querySelector('.popover') - .addEventListener('mouseleave', mouseleave.bind($featureHighlight)); + $('.popover') + .on('mouseleave', mouseleave.bind($featureHighlight)); } }; @@ -53,6 +53,6 @@ export const setupDismissButton = function setupDismissButton() { const cookieId = this.dataset.highlight; const $popover = $(this); - document.querySelector(`#${popoverId} .dismiss-feature-highlight`) - .addEventListener('click', dismiss.bind($popover, cookieId)); + $(`#${popoverId} .dismiss-feature-highlight`) + .on('click', dismiss.bind($popover, cookieId)); }; -- cgit v1.2.1