mirror of
https://github.com/Polymer/polymer.git
synced 2026-08-19 01:14:44 -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} */
|
/** @type {?MutationObserver} */
|
||||||
let observer = null;
|
let observer = null;
|
||||||
|
|
||||||
let DOCUMENT_DIR = '';
|
let documentDir = '';
|
||||||
|
|
||||||
function getRTL() {
|
function getRTL() {
|
||||||
DOCUMENT_DIR = document.documentElement.getAttribute('dir');
|
documentDir = document.documentElement.getAttribute('dir');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -43,13 +43,13 @@ function getRTL() {
|
|||||||
function setRTL(instance) {
|
function setRTL(instance) {
|
||||||
if (!instance.__autoDirOptOut) {
|
if (!instance.__autoDirOptOut) {
|
||||||
const el = /** @type {!HTMLElement} */(instance);
|
const el = /** @type {!HTMLElement} */(instance);
|
||||||
el.setAttribute('dir', DOCUMENT_DIR);
|
el.setAttribute('dir', documentDir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateDirection() {
|
function updateDirection() {
|
||||||
getRTL();
|
getRTL();
|
||||||
DOCUMENT_DIR = document.documentElement.getAttribute('dir');
|
documentDir = document.documentElement.getAttribute('dir');
|
||||||
for (let i = 0; i < DIR_INSTANCES.length; i++) {
|
for (let i = 0; i < DIR_INSTANCES.length; i++) {
|
||||||
setRTL(DIR_INSTANCES[i]);
|
setRTL(DIR_INSTANCES[i]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,10 +62,10 @@ function isMouseEvent(name) {
|
|||||||
|
|
||||||
/* eslint no-empty: ["error", { "allowEmptyCatch": true }] */
|
/* eslint no-empty: ["error", { "allowEmptyCatch": true }] */
|
||||||
// check for passive event listeners
|
// check for passive event listeners
|
||||||
let SUPPORTS_PASSIVE = false;
|
let supportsPassive = false;
|
||||||
(function() {
|
(function() {
|
||||||
try {
|
try {
|
||||||
let opts = Object.defineProperty({}, 'passive', {get() {SUPPORTS_PASSIVE = true;}});
|
let opts = Object.defineProperty({}, 'passive', {get() {supportsPassive = true;}});
|
||||||
window.addEventListener('test', null, opts);
|
window.addEventListener('test', null, opts);
|
||||||
window.removeEventListener('test', null, opts);
|
window.removeEventListener('test', null, opts);
|
||||||
} catch(e) {}
|
} catch(e) {}
|
||||||
@@ -83,7 +83,7 @@ function PASSIVE_TOUCH(eventName) {
|
|||||||
if (isMouseEvent(eventName) || eventName === 'touchend') {
|
if (isMouseEvent(eventName) || eventName === 'touchend') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (HAS_NATIVE_TA && SUPPORTS_PASSIVE && passiveTouchGestures) {
|
if (HAS_NATIVE_TA && supportsPassive && passiveTouchGestures) {
|
||||||
return {passive: true};
|
return {passive: true};
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
@@ -334,7 +334,7 @@ function untrackDocument(stateObj) {
|
|||||||
if (cancelSyntheticClickEvents) {
|
if (cancelSyntheticClickEvents) {
|
||||||
// use a document-wide touchend listener to start the ghost-click prevention mechanism
|
// use a document-wide touchend listener to start the ghost-click prevention mechanism
|
||||||
// Use passive event listeners, if supported, to not affect scrolling performance
|
// 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