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

Side by Side Diff: third_party/polymer/components-chromium/core-dropdown/core-dropdown-base-extracted.js

Issue 1215543002: Remove Polymer 0.5. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix unit test Created 5 years, 5 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 unified diff | Download patch
OLDNEW
(Empty)
1
2
3 Polymer('core-dropdown-base',{
4
5 publish: {
6
7 /**
8 * True if the menu is open.
9 *
10 * @attribute opened
11 * @type boolean
12 * @default false
13 */
14 opened: false
15
16 },
17
18 eventDelegates: {
19 'tap': 'toggleOverlay'
20 },
21
22 overlayListeners: {
23 'core-overlay-open': 'openAction'
24 },
25
26 get dropdown() {
27 if (!this._dropdown) {
28 this._dropdown = this.querySelector('.dropdown');
29 for (var l in this.overlayListeners) {
30 this.addElementListener(this._dropdown, l, this.overlayListeners[l]);
31 }
32 }
33 return this._dropdown;
34 },
35
36 attached: function() {
37 // find the dropdown on attach
38 // FIXME: Support MO?
39 this.dropdown;
40 },
41
42 addElementListener: function(node, event, methodName, capture) {
43 var fn = this._makeBoundListener(methodName);
44 if (node && fn) {
45 Polymer.addEventListener(node, event, fn, capture);
46 }
47 },
48
49 removeElementListener: function(node, event, methodName, capture) {
50 var fn = this._makeBoundListener(methodName);
51 if (node && fn) {
52 Polymer.removeEventListener(node, event, fn, capture);
53 }
54 },
55
56 _makeBoundListener: function(methodName) {
57 var self = this, method = this[methodName];
58 if (!method) {
59 return;
60 }
61 var bound = '_bound' + methodName;
62 if (!this[bound]) {
63 this[bound] = function(e) {
64 method.call(self, e);
65 };
66 }
67 return this[bound];
68 },
69
70 openedChanged: function() {
71 if (this.disabled) {
72 return;
73 }
74 var dropdown = this.dropdown;
75 if (dropdown) {
76 dropdown.opened = this.opened;
77 }
78 },
79
80 openAction: function(e) {
81 this.opened = !!e.detail;
82 },
83
84 toggleOverlay: function() {
85 this.opened = !this.opened;
86 }
87
88 });
89
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698