mirror of
https://github.com/Polymer/polymer.git
synced 2026-08-17 16:34:49 -05:00
Only use CONST_CASE for constants. (#5564)
Otherwise it looks suspicious to closure compiler, and triggers a warning.
This commit is contained in:
@@ -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]);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user