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

Unified Diff: polymer_0.5.0/bower_components/core-dropdown/core-dropdown-base.html

Issue 786953007: npm_modules: Fork bower_components into Polymer 0.4.0 and 0.5.0 versions (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: Created 5 years, 12 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: polymer_0.5.0/bower_components/core-dropdown/core-dropdown-base.html
diff --git a/polymer_0.5.0/bower_components/core-dropdown/core-dropdown-base.html b/polymer_0.5.0/bower_components/core-dropdown/core-dropdown-base.html
new file mode 100644
index 0000000000000000000000000000000000000000..f54abd4cc44c657529ab336bfd7ecc3cddf12b5a
--- /dev/null
+++ b/polymer_0.5.0/bower_components/core-dropdown/core-dropdown-base.html
@@ -0,0 +1,117 @@
+<!--
+Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
+This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
+The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
+The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
+Code distributed by Google as part of the polymer project is also
+subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
+-->
+
+<!--
+
+`core-dropdown-base` is a base class for implementing controls that displays
+an overlay when tapped on.
+
+The child element with the class `dropdown` will be used as the drop-down. It
+should be a `core-dropdown` or other overlay element.
+
+@group Polymer Core Elements
+@element core-dropdown-base
+@status unstable
+@homepage github.io
+-->
+
+<link href="../polymer/polymer.html" rel="import">
+
+<polymer-element name="core-dropdown-base" tabindex="0">
+<script>
+
+ Polymer({
+
+ publish: {
+
+ /**
+ * True if the menu is open.
+ *
+ * @attribute opened
+ * @type boolean
+ * @default false
+ */
+ opened: false
+
+ },
+
+ eventDelegates: {
+ 'tap': 'toggleOverlay'
+ },
+
+ overlayListeners: {
+ 'core-overlay-open': 'openAction'
+ },
+
+ get dropdown() {
+ if (!this._dropdown) {
+ this._dropdown = this.querySelector('.dropdown');
+ for (var l in this.overlayListeners) {
+ this.addElementListener(this._dropdown, l, this.overlayListeners[l]);
+ }
+ }
+ return this._dropdown;
+ },
+
+ attached: function() {
+ // find the dropdown on attach
+ // FIXME: Support MO?
+ this.dropdown;
+ },
+
+ addElementListener: function(node, event, methodName, capture) {
+ var fn = this._makeBoundListener(methodName);
+ if (node && fn) {
+ Polymer.addEventListener(node, event, fn, capture);
+ }
+ },
+
+ removeElementListener: function(node, event, methodName, capture) {
+ var fn = this._makeBoundListener(methodName);
+ if (node && fn) {
+ Polymer.removeEventListener(node, event, fn, capture);
+ }
+ },
+
+ _makeBoundListener: function(methodName) {
+ var self = this, method = this[methodName];
+ if (!method) {
+ return;
+ }
+ var bound = '_bound' + methodName;
+ if (!this[bound]) {
+ this[bound] = function(e) {
+ method.call(self, e);
+ };
+ }
+ return this[bound];
+ },
+
+ openedChanged: function() {
+ if (this.disabled) {
+ return;
+ }
+ var dropdown = this.dropdown;
+ if (dropdown) {
+ dropdown.opened = this.opened;
+ }
+ },
+
+ openAction: function(e) {
+ this.opened = !!e.detail;
+ },
+
+ toggleOverlay: function() {
+ this.opened = !this.opened;
+ }
+
+ });
+
+</script>
+</polymer-element>

Powered by Google App Engine
This is Rietveld 408576698