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(); |
+ } |
+ } |
+ |
+ }); |
+ |