Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(428)

Unified Diff: pkg/polymer/lib/elements/polymer-ui-theme-aware/polymer-ui-theme-aware.html

Issue 175443005: [polymer] import all elements (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: updated from bower Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/polymer/lib/elements/polymer-ui-theme-aware/polymer-ui-theme-aware.html
diff --git a/pkg/polymer/lib/elements/polymer-ui-theme-aware/polymer-ui-theme-aware.html b/pkg/polymer/lib/elements/polymer-ui-theme-aware/polymer-ui-theme-aware.html
new file mode 100644
index 0000000000000000000000000000000000000000..e683c745da5aae30076e3bd34eb1ebd07d2feac1
--- /dev/null
+++ b/pkg/polymer/lib/elements/polymer-ui-theme-aware/polymer-ui-theme-aware.html
@@ -0,0 +1,40 @@
+<!--
+Copyright 2013 The Polymer Authors. All rights reserved.
+Use of this source code is governed by a BSD-style
+license that can be found in the LICENSE file.
+-->
+<link rel="import" href="../polymer/polymer.html">
+
+<polymer-element name="polymer-ui-theme-aware" attributes="theme">
+ <script>
+ 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 || defaultTheme;
+ }
+ };
+ Polymer('polymer-ui-theme-aware', {
+ defaultTheme: '',
+ activeTheme: '',
+ validateTheme: PolymerUI.validateTheme,
+ enteredView: function() {
+ this.validateTheme();
+ },
+ themeChanged: function() {
+ this.activeTheme = this.theme;
+ },
+ activeThemeChanged: function(old) {
+ this.classList.switch(old, this.activeTheme);
+ }
+ });
+ </script>
+</polymer-element>

Powered by Google App Engine
This is Rietveld 408576698