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

Unified Diff: third_party/polymer/components-chromium/core-menu/core-submenu-extracted.js

Issue 592593002: Inline scripts were extracted from Polymer elements. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: s/echo ""/echo/ Created 6 years, 3 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: third_party/polymer/components-chromium/core-menu/core-submenu-extracted.js
diff --git a/third_party/polymer/components-chromium/core-menu/core-submenu-extracted.js b/third_party/polymer/components-chromium/core-menu/core-submenu-extracted.js
new file mode 100644
index 0000000000000000000000000000000000000000..0f0c38587971b3ac1ffc0ac6c9bc361345cfd720
--- /dev/null
+++ b/third_party/polymer/components-chromium/core-menu/core-submenu-extracted.js
@@ -0,0 +1,45 @@
+
+
+ Polymer('core-submenu', {
+
+ publish: {
+ active: {value: false, reflect: true}
+ },
+
+ opened: false,
+
+ get items() {
+ return this.$.submenu.items;
+ },
+
+ hasItems: function() {
+ return !!this.items.length;
+ },
+
+ unselectAllItems: function() {
+ this.$.submenu.selected = null;
+ this.$.submenu.clearSelection();
+ },
+
+ activeChanged: function() {
+ if (this.hasItems()) {
+ this.opened = this.active;
+ }
+ if (!this.active) {
+ this.unselectAllItems();
+ }
+ },
+
+ toggle: function() {
+ this.opened = !this.opened;
+ },
+
+ activate: function() {
+ if (this.hasItems() && this.active) {
+ this.toggle();
+ this.unselectAllItems();
+ }
+ }
+
+ });
+

Powered by Google App Engine
This is Rietveld 408576698