Skip to content

Commit

Permalink
Only use CONST_CASE for constants. (#5564)
Browse files Browse the repository at this point in the history
Otherwise it looks suspicious to closure compiler, and triggers a warning.
  • Loading branch information
rictic authored Jun 27, 2019
1 parent ac12b3b commit 54f8b47
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions lib/mixins/dir-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

/**
Expand All @@ -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]);
}
Expand Down
8 changes: 4 additions & 4 deletions lib/utils/gestures.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}
Expand All @@ -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;
Expand Down Expand Up @@ -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);
}

/**
Expand Down

0 comments on commit 54f8b47

Please sign in to comment.