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

Side by Side Diff: remoting/webapp/menu_button.js

Issue 584693003: Fix MenuButton for the case where multiple listeners are defined. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Temporarily disable unit test. 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 unified diff | Download patch
« no previous file with comments | « no previous file | remoting/webapp/unittests/menu_button_unittest.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview 6 * @fileoverview
7 * Class representing a menu button and its associated menu items. 7 * Class representing a menu button and its associated menu items.
8 */ 8 */
9 9
10 'use strict'; 10 'use strict';
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 }; 63 };
64 64
65 /** 65 /**
66 * @type {function(Event):void} 66 * @type {function(Event):void}
67 * @private 67 * @private
68 */ 68 */
69 var onClick = function(event) { 69 var onClick = function(event) {
70 if (that.onShow_) { 70 if (that.onShow_) {
71 that.onShow_(); 71 that.onShow_();
72 } 72 }
73 that.button_.classList.toggle(remoting.MenuButton.BUTTON_ACTIVE_CLASS_); 73 that.button_.classList.add(remoting.MenuButton.BUTTON_ACTIVE_CLASS_);
74 document.body.addEventListener('click', closeHandler, false); 74 document.body.addEventListener('click', closeHandler, false);
75 event.stopPropagation(); 75 event.stopPropagation();
76 }; 76 };
77 77
78 this.button_.addEventListener('click', onClick, false); 78 this.button_.addEventListener('click', onClick, false);
79 }; 79 };
80 80
81 /** 81 /**
82 * @return {HTMLElement} The button that activates the menu. 82 * @return {HTMLElement} The button that activates the menu.
83 */ 83 */
(...skipping 17 matching lines...) Expand all
101 remoting.MenuButton.select = function(item, selected) { 101 remoting.MenuButton.select = function(item, selected) {
102 if (selected) { 102 if (selected) {
103 /** @type {DOMTokenList} */(item.classList).add('selected'); 103 /** @type {DOMTokenList} */(item.classList).add('selected');
104 } else { 104 } else {
105 /** @type {DOMTokenList} */(item.classList).remove('selected'); 105 /** @type {DOMTokenList} */(item.classList).remove('selected');
106 } 106 }
107 }; 107 };
108 108
109 /** @const @private */ 109 /** @const @private */
110 remoting.MenuButton.BUTTON_ACTIVE_CLASS_ = 'active'; 110 remoting.MenuButton.BUTTON_ACTIVE_CLASS_ = 'active';
OLDNEW
« no previous file with comments | « no previous file | remoting/webapp/unittests/menu_button_unittest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698