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..91399fb525026b36a1021c8e2001a3cdceca057a 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} selectorOrElement The selector of the element |
| + * from this row's root, or the element itself. |
| * @return {boolean} Whether a new item was added. |
| */ |
| - addItem: function(type, query) { |
| + addItem: function(type, selectorOrElement) { |
| assert(type); |
| - var element = this.root.querySelector(query); |
| + var element; |
| + if (typeof selectorOrElement == 'string') |
| + element = this.root.querySelector(selectorOrElement); |
| + else |
| + element = selectorOrElement; |
|
Dan Beam
2017/03/21 07:11:52
why can't you just munge the argument? because it
scottchen
2017/03/21 20:10:33
Could you give me an example of how you'd do the m
Dan Beam
2017/03/21 20:51:56
I didn't see that there's a bunch of uses of |elem
|
| if (!element) |
| return false; |