Chromium Code Reviews| Index: ui/webui/resources/js/cr/ui/focus_row.js |
| diff --git a/ui/webui/resources/js/cr/ui/focus_row.js b/ui/webui/resources/js/cr/ui/focus_row.js |
| index 652b0353f61a2ab23e4fb8dda774747ac55322f6..bfe13e23b67512b650d6dad924213c4bea6a40c5 100644 |
| --- a/ui/webui/resources/js/cr/ui/focus_row.js |
| +++ b/ui/webui/resources/js/cr/ui/focus_row.js |
| @@ -105,13 +105,18 @@ cr.define('cr.ui', function() { |
| * to indicate they're equivalent. |
| * |
| * @param {string} type The type of element to track focus of. |
| - * @param {string} query The selector of the element from this row's root. |
| + * @param {string|HTMLElement} selector The selector of the element from |
|
Dan Beam
2017/03/18 00:09:57
selectorOrElement
scottchen
2017/03/18 01:05:47
Done.
|
| + * this row's root, or the element itself. |
| * @return {boolean} Whether a new item was added. |
| */ |
| - addItem: function(type, query) { |
| + addItem: function(type, selector) { |
| assert(type); |
| - var element = this.root.querySelector(query); |
| + var element; |
| + if (selector instanceof HTMLElement) |
|
Dan Beam
2017/03/18 00:09:57
typeof selector == 'string' is better (works acros
scottchen
2017/03/18 01:05:47
Acknowledged.
|
| + element = selector; |
| + else |
| + element = this.root.querySelector(/** @type {string} */ (selector)); |
|
Dan Beam
2017/03/18 00:09:57
if (typeof selectorOrElement == 'string')
elemen
scottchen
2017/03/18 01:05:47
Done.
|
| if (!element) |
| return false; |