From 54f8b47fee3a7a23147aa7177d83f6e7b8eeeabc Mon Sep 17 00:00:00 2001 From: Peter Burns Date: Thu, 27 Jun 2019 13:00:47 -0700 Subject: [PATCH] Only use CONST_CASE for constants. (#5564) Otherwise it looks suspicious to closure compiler, and triggers a warning. --- lib/mixins/dir-mixin.js | 8 ++++---- lib/utils/gestures.js | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/mixins/dir-mixin.js b/lib/mixins/dir-mixin.js index 1957bb489c..df9c86e290 100644 --- a/lib/mixins/dir-mixin.js +++ b/lib/mixins/dir-mixin.js @@ -31,10 +31,10 @@ const DIR_INSTANCES = []; /** @type {?MutationObserver} */ let observer = null; -let DOCUMENT_DIR = ''; +let documentDir = ''; function getRTL() { - DOCUMENT_DIR = document.documentElement.getAttribute('dir'); + documentDir = document.documentElement.getAttribute('dir'); } /** @@ -43,13 +43,13 @@ function getRTL() { function setRTL(instance) { if (!instance.__autoDirOptOut) { const el = /** @type {!HTMLElement} */(instance); - el.setAttribute('dir', DOCUMENT_DIR); + el.setAttribute('dir', documentDir); } } function updateDirection() { getRTL(); - DOCUMENT_DIR = document.documentElement.getAttribute('dir'); + documentDir = document.documentElement.getAttribute('dir'); for (let i = 0; i < DIR_INSTANCES.length; i++) { setRTL(DIR_INSTANCES[i]); } diff --git a/lib/utils/gestures.js b/lib/utils/gestures.js index e6c8416b6e..24a620c784 100644 --- a/lib/utils/gestures.js +++ b/lib/utils/gestures.js @@ -62,10 +62,10 @@ function isMouseEvent(name) { /* eslint no-empty: ["error", { "allowEmptyCatch": true }] */ // check for passive event listeners -let SUPPORTS_PASSIVE = false; +let supportsPassive = false; (function() { try { - let opts = Object.defineProperty({}, 'passive', {get() {SUPPORTS_PASSIVE = true;}}); + let opts = Object.defineProperty({}, 'passive', {get() {supportsPassive = true;}}); window.addEventListener('test', null, opts); window.removeEventListener('test', null, opts); } catch(e) {} @@ -83,7 +83,7 @@ function PASSIVE_TOUCH(eventName) { if (isMouseEvent(eventName) || eventName === 'touchend') { return; } - if (HAS_NATIVE_TA && SUPPORTS_PASSIVE && passiveTouchGestures) { + if (HAS_NATIVE_TA && supportsPassive && passiveTouchGestures) { return {passive: true}; } else { return; @@ -334,7 +334,7 @@ function untrackDocument(stateObj) { if (cancelSyntheticClickEvents) { // use a document-wide touchend listener to start the ghost-click prevention mechanism // Use passive event listeners, if supported, to not affect scrolling performance - document.addEventListener('touchend', ignoreMouse, SUPPORTS_PASSIVE ? {passive: true} : false); + document.addEventListener('touchend', ignoreMouse, supportsPassive ? {passive: true} : false); } /**