Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
add defaultTheme and allow themeAware element to define its own
Browse files Browse the repository at this point in the history
defaultTheme to use when no theme is found
  • Loading branch information
frankiefu committed Nov 18, 2013
1 parent 6b45e35 commit acf5df3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion polymer-ui-theme-aware.html
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit acf5df3

Please sign in to comment.