Chromium Code Reviews| Index: chrome/browser/resources/bookmark_manager/js/dnd.js |
| diff --git a/chrome/browser/resources/bookmark_manager/js/dnd.js b/chrome/browser/resources/bookmark_manager/js/dnd.js |
| index 7b2ee40a05d62af0bb14bd9ed86acc9d842dce18..5f246e30d84cf1a0d5e2f4bef6c4e1f20978a591 100644 |
| --- a/chrome/browser/resources/bookmark_manager/js/dnd.js |
| +++ b/chrome/browser/resources/bookmark_manager/js/dnd.js |
| @@ -47,7 +47,7 @@ cr.define('dnd', function() { |
| /** |
| * The style that was applied to indicate the drop location. |
| - * @type {string} |
| + * @type {?string} |
| */ |
| var lastIndicatorClassName; |
| @@ -194,7 +194,7 @@ cr.define('dnd', function() { |
| /** |
| * External function to select folders or bookmarks after a drop action. |
| - * @type {function} |
| + * @type {Function} |
|
Dan Beam
2014/09/23 02:46:55
nit: ?Function
Vitaly Pavlenko
2014/09/23 22:20:55
Done.
|
| */ |
| var selectItemsAfterUserAction = null; |
| @@ -208,7 +208,7 @@ cr.define('dnd', function() { |
| // If we are over the list and the list is showing search result, we cannot |
| // drop. |
| function isOverSearch(overElement) { |
| - return list.isSearch() && list.contains(overElement); |
| + return $('list').isSearch() && $('list').contains(overElement); |
|
Dan Beam
2014/09/23 02:46:56
i think for now it'd probably be better to do:
Vitaly Pavlenko
2014/09/23 22:20:55
Nah, it doesn't work: at the time when the top of
|
| } |
| /** |
| @@ -219,7 +219,7 @@ cr.define('dnd', function() { |
| */ |
| function calculateValidDropTargets(overElement) { |
| // Don't allow dropping if there is an ephemeral item being edited. |
| - if (list.hasEphemeral()) |
| + if ($('list').hasEphemeral()) |
| return DropPosition.NONE; |
| if (!dragInfo.isDragValid() || isOverSearch(overElement)) |
| @@ -302,7 +302,7 @@ cr.define('dnd', function() { |
| // We are trying to drop an item past the last item. This is |
| // only allowed if dragged item is different from the last item |
| // in the list. |
| - var listItems = list.items; |
| + var listItems = $('list').items; |
| var len = listItems.length; |
| if (!len || !dragInfo.isDraggingBookmark(listItems[len - 1].bookmarkId)) |
| return true; |
| @@ -333,7 +333,7 @@ cr.define('dnd', function() { |
| // Do not allow dragging if there is an ephemeral item being edited at the |
| // moment. |
| - if (list.hasEphemeral()) |
| + if ($('list').hasEphemeral()) |
| return; |
| if (draggedNodes.length) { |
| @@ -371,7 +371,7 @@ cr.define('dnd', function() { |
| return; |
| var overElement = getBookmarkElement(e.target) || |
| - (e.target == list ? list : null); |
| + (e.target == $('list') ? $('list') : null); |
| if (!overElement) |
| return; |
| @@ -450,16 +450,16 @@ cr.define('dnd', function() { |
| if (overElement instanceof ListItem) { |
| dropInfoResult.relatedIndex = |
| overElement.parentNode.dataModel.indexOf(relatedNode); |
| - dropInfoResult.selectTarget = list; |
| + dropInfoResult.selectTarget = $('list'); |
| } else if (overElement instanceof BookmarkList) { |
| dropInfoResult.relatedIndex = overElement.dataModel.length - 1; |
| - dropInfoResult.selectTarget = list; |
| + dropInfoResult.selectTarget = $('list'); |
| } else { |
| // Tree |
| dropInfoResult.relatedIndex = relatedNode.index; |
| - dropInfoResult.selectTarget = tree; |
| + dropInfoResult.selectTarget = $('tree'); |
| dropInfoResult.selectedTreeId = |
| - tree.selectedItem ? tree.selectedItem.bookmarkId : null; |
| + $('tree').selectedItem ? $('tree').selectedItem.bookmarkId : null; |
| } |
| if (dropPos == DropPosition.ABOVE) |
| @@ -508,7 +508,7 @@ cr.define('dnd', function() { |
| function init(selectItemsAfterUserActionFunction) { |
| function deferredClearData() { |
| - setTimeout(clearDragData); |
| + setTimeout(clearDragData, 0); |
| } |
| selectItemsAfterUserAction = selectItemsAfterUserActionFunction; |