From acf5df31ab223fab70d25da64009f79b3cebd7a7 Mon Sep 17 00:00:00 2001 From: frankiefu Date: Mon, 18 Nov 2013 14:59:59 -0800 Subject: [PATCH] add defaultTheme and allow themeAware element to define its own defaultTheme to use when no theme is found --- polymer-ui-theme-aware.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/polymer-ui-theme-aware.html b/polymer-ui-theme-aware.html index 6781235..e683c74 100644 --- a/polymer-ui-theme-aware.html +++ b/polymer-ui-theme-aware.html @@ -10,17 +10,20 @@ PolymerUI = { validateTheme: function() { var theme = this.theme; + var defaultTheme = this.defaultTheme; if (!theme) { var p = this; while (p && !theme) { theme = p.getAttribute && p.getAttribute('theme'); + defaultTheme = defaultTheme || p.defaultTheme; p = p.parentNode || p.host; } } - this.activeTheme = this.theme || theme; + this.activeTheme = this.theme || theme || defaultTheme; } }; Polymer('polymer-ui-theme-aware', { + defaultTheme: '', activeTheme: '', validateTheme: PolymerUI.validateTheme, enteredView: function() {