| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 cr.define('cr.ui', function() { | 5 cr.define('cr.ui', function() { |
| 6 const Command = cr.ui.Command; | 6 const Command = cr.ui.Command; |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * Creates a new menu item element. | 9 * Creates a new menu item element. |
| 10 * @param {Object=} opt_propertyBag Optional properties. | 10 * @param {Object=} opt_propertyBag Optional properties. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 /** | 29 /** |
| 30 * Initializes the menu item. | 30 * Initializes the menu item. |
| 31 */ | 31 */ |
| 32 decorate: function() { | 32 decorate: function() { |
| 33 var commandId; | 33 var commandId; |
| 34 if ((commandId = this.getAttribute('command'))) | 34 if ((commandId = this.getAttribute('command'))) |
| 35 this.command = commandId; | 35 this.command = commandId; |
| 36 | 36 |
| 37 this.addEventListener('mouseup', this.handleMouseUp_); | 37 this.addEventListener('mouseup', this.handleMouseUp_); |
| 38 | 38 |
| 39 // Adding the 'custom-appearance' class prevents button.css from changing | 39 // Adding the 'custom-appearance' class prevents widgets.css from changing |
| 40 // the appearance of this element. | 40 // the appearance of this element. |
| 41 this.classList.add('custom-appearance'); | 41 this.classList.add('custom-appearance'); |
| 42 }, | 42 }, |
| 43 | 43 |
| 44 /** | 44 /** |
| 45 * The command associated with this menu item. If this is set to a string | 45 * The command associated with this menu item. If this is set to a string |
| 46 * of the form "#element-id" then the element is looked up in the document | 46 * of the form "#element-id" then the element is looked up in the document |
| 47 * of the command. | 47 * of the command. |
| 48 * @type {cr.ui.Command} | 48 * @type {cr.ui.Command} |
| 49 */ | 49 */ |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 * Whether the menu item is checked or not. | 159 * Whether the menu item is checked or not. |
| 160 * @type {boolean} | 160 * @type {boolean} |
| 161 */ | 161 */ |
| 162 cr.defineProperty(MenuItem, 'checked', cr.PropertyKind.BOOL_ATTR); | 162 cr.defineProperty(MenuItem, 'checked', cr.PropertyKind.BOOL_ATTR); |
| 163 | 163 |
| 164 // Export | 164 // Export |
| 165 return { | 165 return { |
| 166 MenuItem: MenuItem | 166 MenuItem: MenuItem |
| 167 }; | 167 }; |
| 168 }); | 168 }); |
| OLD | NEW |