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..b2488510e13ef70d75d23aace37e97d39df4a50b 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} query The selector of the element from this |
|
hcarmona
2017/03/16 21:31:54
nit: rename |query| to |selector|
scottchen
2017/03/17 21:26:59
good idea, wasn't sure what to name it.
|
| + * row's root, or the element itself. |
| * @return {boolean} Whether a new item was added. |
| */ |
| addItem: function(type, query) { |
| assert(type); |
| - var element = this.root.querySelector(query); |
| + var element; |
| + if (query instanceof HTMLElement) |
| + element = query; |
| + else |
| + element = this.root.querySelector(/** @type {string} */ (query)); |
| if (!element) |
| return false; |