From dd57ddbef6c1ddcc5429daa6b4b334da9635708b Mon Sep 17 00:00:00 2001 From: Andrey Date: Sun, 27 May 2018 18:56:01 +0300 Subject: [PATCH] Try to use existing updateStyles for theming (#1217) --- src/common/dom/apply_themes_on_element.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/common/dom/apply_themes_on_element.js b/src/common/dom/apply_themes_on_element.js index 267b9bafd8..a21ac4ed82 100644 --- a/src/common/dom/apply_themes_on_element.js +++ b/src/common/dom/apply_themes_on_element.js @@ -23,8 +23,10 @@ export default function applyThemesOnElement(element, themes, localTheme, update styles[prefixedKey] = theme[key]; }); } - // implement updateStyles() method of Polemer elements - if (window.ShadyCSS) { + if (element.updateStyles) { + element.updateStyles(styles); + } else if (window.ShadyCSS) { + // implement updateStyles() method of Polemer elements window.ShadyCSS.styleSubtree(/** @type {!HTMLElement} */(element), styles); }