Chromium Code Reviews| Index: ui/webui/resources/js/cr/ui/context_menu_button.js |
| diff --git a/ui/webui/resources/js/cr/ui/context_menu_button.js b/ui/webui/resources/js/cr/ui/context_menu_button.js |
| index 7d324e3ce0fde81f7e45aac4e434ca55edb84bbf..700cb416b5124f73e55b7eb7e8f554e76f79f239 100644 |
| --- a/ui/webui/resources/js/cr/ui/context_menu_button.js |
| +++ b/ui/webui/resources/js/cr/ui/context_menu_button.js |
| @@ -13,14 +13,15 @@ cr.define('cr.ui', function() { |
| /** |
| * Helper function for ContextMenuButton to find the first ancestor of the |
| * button that has a context menu. |
| - * @param {!MenuButton} el The button to start the search from. |
| + * @param {!cr.ui.MenuButton} button The button to start the search from. |
| * @return {HTMLElement} The found element or null if not found. |
| */ |
| - function getContextMenuTarget(el) { |
| + function getContextMenuTarget(button) { |
| + var el = button; |
| do { |
| el = el.parentNode; |
| } while (el && !('contextMenu' in el)); |
| - return el; |
| + return assertInstanceof(el, HTMLElement); |
|
Dan Beam
2014/09/23 02:46:56
what happens when el is null?
Vitaly Pavlenko
2014/09/23 22:20:55
Done.
|
| } |
| /** |
| @@ -28,7 +29,7 @@ cr.define('cr.ui', function() { |
| * ancestor that has a {@code contextMenu} property. |
| * @param {Object=} opt_propertyBag Optional properties. |
| * @constructor |
| - * @extends {MenuButton} |
| + * @extends {cr.ui.MenuButton} |
| */ |
| var ContextMenuButton = cr.ui.define('button'); |
| @@ -80,7 +81,7 @@ cr.define('cr.ui', function() { |
| var self = this; |
| window.setTimeout(function() { |
| MenuButton.prototype.showMenu.call(self, shouldSetFocus); |
| - }); |
| + }, 0); |
| } |
| }; |