diff --git a/node_modules/css-vars-ponyfill/dist/css-vars-ponyfill.esm.js b/node_modules/css-vars-ponyfill/dist/css-vars-ponyfill.esm.js index 7516006..4553cd0 100644 --- a/node_modules/css-vars-ponyfill/dist/css-vars-ponyfill.esm.js +++ b/node_modules/css-vars-ponyfill/dist/css-vars-ponyfill.esm.js @@ -1193,9 +1193,17 @@ var isShadowDOMReady = false; var hasVarChange = false; if (settings.updateDOM) { var targetElm = settings.rootElement.host || (settings.rootElement === document ? document.documentElement : settings.rootElement); + var compst = getComputedStyle(targetElm); + + // NOTE: Make reads and writes in separate loops + // to avoid triggering forced reflows. + Object.keys(settings.variables).forEach((function(key) { + var varValue = settings.variables[key]; + hasVarChange = hasVarChange || varValue !== compst.getPropertyValue(key); + })); + Object.keys(settings.variables).forEach((function(key) { var varValue = settings.variables[key]; - hasVarChange = hasVarChange || varValue !== getComputedStyle(targetElm).getPropertyValue(key); targetElm.style.setProperty(key, varValue); })); }