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('options', function() { | 5 cr.define('options', function() { |
6 const DeletableItem = options.DeletableItem; | 6 const DeletableItem = options.DeletableItem; |
7 const DeletableItemList = options.DeletableItemList; | 7 const DeletableItemList = options.DeletableItemList; |
8 | 8 |
9 /** | 9 /** |
10 * Creates a new list item with support for inline editing. | 10 * Creates a new list item with support for inline editing. |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
349 | 349 |
350 /** | 350 /** |
351 * Takes care of committing changes to inline editable list items when the | 351 * Takes care of committing changes to inline editable list items when the |
352 * window loses focus. | 352 * window loses focus. |
353 */ | 353 */ |
354 function handleWindowBlurs() { | 354 function handleWindowBlurs() { |
355 window.addEventListener('blur', function(e) { | 355 window.addEventListener('blur', function(e) { |
356 var itemAncestor = findAncestor(document.activeElement, function(node) { | 356 var itemAncestor = findAncestor(document.activeElement, function(node) { |
357 return node instanceof InlineEditableItem; | 357 return node instanceof InlineEditableItem; |
358 }); | 358 }); |
359 if (itemAncestor); | 359 if (itemAncestor) |
Tyler Breisacher (Chromium)
2012/03/09 22:36:17
This one should be safe too, unless we're somehow
| |
360 document.activeElement.blur(); | 360 document.activeElement.blur(); |
361 }); | 361 }); |
362 } | 362 } |
363 handleWindowBlurs(); | 363 handleWindowBlurs(); |
364 | 364 |
365 var InlineEditableItemList = cr.ui.define('list'); | 365 var InlineEditableItemList = cr.ui.define('list'); |
366 | 366 |
367 InlineEditableItemList.prototype = { | 367 InlineEditableItemList.prototype = { |
368 __proto__: DeletableItemList.prototype, | 368 __proto__: DeletableItemList.prototype, |
369 | 369 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
406 return true; | 406 return true; |
407 }, | 407 }, |
408 }; | 408 }; |
409 | 409 |
410 // Export | 410 // Export |
411 return { | 411 return { |
412 InlineEditableItem: InlineEditableItem, | 412 InlineEditableItem: InlineEditableItem, |
413 InlineEditableItemList: InlineEditableItemList, | 413 InlineEditableItemList: InlineEditableItemList, |
414 }; | 414 }; |
415 }); | 415 }); |
OLD | NEW |