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 // TODO(arv): Now that this is driven by a data model, implement a data model | 5 // TODO(arv): Now that this is driven by a data model, implement a data model |
| 6 // that handles the loading and the events from the bookmark backend. | 6 // that handles the loading and the events from the bookmark backend. |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * @typedef {{childIds: Array<string>}} | 9 * @typedef {{childIds: Array<string>}} |
| 10 * | 10 * |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 472 }, | 472 }, |
| 473 set editing(editing) { | 473 set editing(editing) { |
| 474 var oldEditing = this.editing; | 474 var oldEditing = this.editing; |
| 475 if (oldEditing == editing) | 475 if (oldEditing == editing) |
| 476 return; | 476 return; |
| 477 | 477 |
| 478 var url = this.bookmarkNode.url; | 478 var url = this.bookmarkNode.url; |
| 479 var title = this.bookmarkNode.title; | 479 var title = this.bookmarkNode.title; |
| 480 var isFolder = bmm.isFolder(this.bookmarkNode); | 480 var isFolder = bmm.isFolder(this.bookmarkNode); |
| 481 var listItem = this; | 481 var listItem = this; |
| 482 var labelEl = this.firstChild; | 482 var labelEl = this.querySelector('.label-text'); |
| 483 var urlEl = labelEl.nextSibling; | 483 var urlEl = this.querySelector('.url'); |
|
Peter Kasting
2016/10/26 01:49:57
I could have used a bunch of .firstChild.nextSibli
Peter Kasting
2016/10/26 02:56:30
...however, now Closure compiler complains that la
Dan Beam
2016/10/26 03:06:21
assert(), queryRequiredElement() or /** @type {!El
Peter Kasting
2016/10/26 03:33:59
Thanks; used queryRequiredElement() since that see
| |
| 484 var labelInput, urlInput; | 484 var labelInput, urlInput; |
| 485 | 485 |
| 486 // Handles enter and escape which trigger reset and commit respectively. | 486 // Handles enter and escape which trigger reset and commit respectively. |
| 487 function handleKeydown(e) { | 487 function handleKeydown(e) { |
| 488 // Make sure that the tree does not handle the key. | 488 // Make sure that the tree does not handle the key. |
| 489 e.stopPropagation(); | 489 e.stopPropagation(); |
| 490 | 490 |
| 491 // Calling list.focus blurs the input which will stop editing the list | 491 // Calling list.focus blurs the input which will stop editing the list |
| 492 // item. | 492 // item. |
| 493 switch (e.key) { | 493 switch (e.key) { |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 640 } | 640 } |
| 641 } | 641 } |
| 642 } | 642 } |
| 643 }; | 643 }; |
| 644 | 644 |
| 645 return { | 645 return { |
| 646 BookmarkList: BookmarkList, | 646 BookmarkList: BookmarkList, |
| 647 list: /** @type {Element} */(null), // Set when decorated. | 647 list: /** @type {Element} */(null), // Set when decorated. |
| 648 }; | 648 }; |
| 649 }); | 649 }); |
| OLD | NEW |