mirror of
https://github.com/Polymer/polymer.git
synced 2025-02-25 18:55:30 -06:00
Check for ShadyDOM and :dir selectors before trying css transform
Should save a considerable amount of style processing when not needed.
This commit is contained in:
@@ -17,6 +17,10 @@ const HOST_DIR_REPLACMENT = ':host([dir="$1"])';
|
||||
const EL_DIR = /([\s\w-#\.\[\]\*]*):dir\((ltr|rtl)\)/g;
|
||||
const EL_DIR_REPLACMENT = ':host([dir="$2"]) $1';
|
||||
|
||||
const DIR_CHECK = /:dir\((?:ltr|rtl)\)/;
|
||||
|
||||
const SHIM_SHADOW = Boolean(window['ShadyDOM'] && window['ShadyDOM']['inUse']);
|
||||
|
||||
/**
|
||||
* @type {!Array<!Polymer_DirMixin>}
|
||||
*/
|
||||
@@ -107,7 +111,9 @@ export const DirMixin = dedupingMixin((base) => {
|
||||
*/
|
||||
static _processStyleText(cssText, baseURI) {
|
||||
cssText = super._processStyleText(cssText, baseURI);
|
||||
cssText = this._replaceDirInCssText(cssText);
|
||||
if (!SHIM_SHADOW && DIR_CHECK.test(cssText)) {
|
||||
cssText = this._replaceDirInCssText(cssText);
|
||||
}
|
||||
return cssText;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user