From d08b6945180f0c2708764ae85beacc024ddb192d Mon Sep 17 00:00:00 2001 From: Daniel Freedman Date: Mon, 26 Sep 2016 12:05:57 -0700 Subject: [PATCH] Fix IE style cache performance Continue workaround from 80be0df for @media staleness, but only refresh the stylesheet if it came from the cache and has @media queries. Fixes #3965 --- src/lib/style-properties.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib/style-properties.html b/src/lib/style-properties.html index 4544ede18a..39006eeb08 100644 --- a/src/lib/style-properties.html +++ b/src/lib/style-properties.html @@ -494,9 +494,13 @@ } // shady and cache hit but not in document } else if (!style.parentNode) { + if (IS_IE && cssText.indexOf('@media') > -1) { + // @media rules may be stale in IE 10 and 11 + // refresh the text content of the style to revalidate them. + style.textContent = cssText; + } styleUtil.applyStyle(style, null, element._scopeStyle); } - } // ensure this style is our custom style and increment its use count. if (style) { @@ -507,10 +511,6 @@ } element._customStyle = style; } - // @media rules may be stale in IE 10 and 11 - if (IS_IE) { - style.textContent = style.textContent; - } return style; },