Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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('print_preview', function() { | 5 cr.define('print_preview', function() { |
| 6 'use strict'; | 6 'use strict'; |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * Component that displays a list of destinations with a heading, action link, | 9 * Component that displays a list of destinations with a heading, action link, |
| 10 * and "Show All..." button. An event is dispatched when the action link is | 10 * and "Show All..." button. An event is dispatched when the action link is |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 329 */ | 329 */ |
| 330 updateListItem_: function(listEl, listItem, focusedEl, destination) { | 330 updateListItem_: function(listEl, listItem, focusedEl, destination) { |
| 331 listItem.update(destination, this.query_); | 331 listItem.update(destination, this.query_); |
| 332 | 332 |
| 333 var itemEl = listItem.getElement(); | 333 var itemEl = listItem.getElement(); |
| 334 // Preserve focused inner element, if there's one. | 334 // Preserve focused inner element, if there's one. |
| 335 var focusedInnerEl = focusedEl ? itemEl.querySelector(':focus') : null; | 335 var focusedInnerEl = focusedEl ? itemEl.querySelector(':focus') : null; |
| 336 if (focusedEl) | 336 if (focusedEl) |
| 337 itemEl.classList.add('moving'); | 337 itemEl.classList.add('moving'); |
| 338 // Move it to the end of the list. | 338 // Move it to the end of the list. |
| 339 listEl.appendChild(itemEl); | 339 if (listEl.lastChild != itemEl) |
|
dpapad
2017/05/23 01:02:06
Without a regression test, and without any comment
tkent
2017/05/23 03:54:53
I found why :focus didn't work, and Patch Set 2 re
| |
| 340 listEl.appendChild(itemEl); | |
| 340 // Restore focus. | 341 // Restore focus. |
| 341 if (focusedEl) { | 342 if (focusedEl) { |
| 342 if (focusedEl == itemEl || focusedEl == focusedInnerEl) | 343 if (focusedEl == itemEl || focusedEl == focusedInnerEl) |
| 343 focusedEl.focus(); | 344 focusedEl.focus(); |
| 344 itemEl.classList.remove('moving'); | 345 itemEl.classList.remove('moving'); |
| 345 } | 346 } |
| 346 }, | 347 }, |
| 347 | 348 |
| 348 /** | 349 /** |
| 349 * @param {Element} listEl List element. | 350 * @param {Element} listEl List element. |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 367 cr.dispatchSimpleEvent(this, | 368 cr.dispatchSimpleEvent(this, |
| 368 DestinationList.EventType.ACTION_LINK_ACTIVATED); | 369 DestinationList.EventType.ACTION_LINK_ACTIVATED); |
| 369 } | 370 } |
| 370 }; | 371 }; |
| 371 | 372 |
| 372 // Export | 373 // Export |
| 373 return { | 374 return { |
| 374 DestinationList: DestinationList | 375 DestinationList: DestinationList |
| 375 }; | 376 }; |
| 376 }); | 377 }); |
| OLD | NEW |