OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 /** | |
6 * @fileoverview An item in a drop-down menu in the ChromeVox panel. | |
7 */ | |
8 | |
9 goog.provide('PanelMenuItem'); | |
10 | |
11 /** | |
12 * @param {string} menuItemTitle The title of the menu item. | |
13 * @param {string} menuItemShortcut The keystrokes to select this item. | |
14 * @param {Function} callback The function to call if this item is selected. | |
15 * @constructor | |
16 */ | |
17 PanelMenuItem = function(menuItemTitle, menuItemShortcut, callback) { | |
18 this.callback = callback; | |
David Tseng
2016/01/12 20:10:57
js doc
| |
19 | |
20 this.element = document.createElement('tr'); | |
21 this.element.className = 'menu-item'; | |
22 this.element.tabIndex = -1; | |
23 this.element.setAttribute('role', 'menuitem'); | |
24 | |
25 this.element.addEventListener('mouseover', (function(evt) { | |
26 this.element.focus(); | |
27 }).bind(this), false); | |
28 | |
29 var title = document.createElement('td'); | |
30 title.className = 'menu-item-title'; | |
31 title.textContent = menuItemTitle; | |
32 this.element.appendChild(title); | |
33 | |
34 var shortcut = document.createElement('td'); | |
35 shortcut.className = 'menu-item-shortcut'; | |
36 shortcut.textContent = menuItemShortcut; | |
37 this.element.appendChild(shortcut); | |
38 }; | |
OLD | NEW |