Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1460)

Unified Diff: ui/webui/resources/js/cr/ui/tree.js

Issue 620663004: Revert of All changes to ui/webui/ from bookmarks CL that block other CLs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@true_master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/webui/resources/js/cr/ui/touch_handler.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/webui/resources/js/cr/ui/tree.js
diff --git a/ui/webui/resources/js/cr/ui/tree.js b/ui/webui/resources/js/cr/ui/tree.js
index 58ca92f52f11478ea373e953452a00585b11a2fd..04f978ebf72ddc4a01a85b31d47ab5e6c90dc452 100644
--- a/ui/webui/resources/js/cr/ui/tree.js
+++ b/ui/webui/resources/js/cr/ui/tree.js
@@ -24,14 +24,14 @@
/**
* Helper function that finds the first ancestor tree item.
- * @param {Node} node The node to start searching from.
+ * @param {!Element} el The element to start searching from.
* @return {cr.ui.TreeItem} The found tree item or null if not found.
*/
- function findTreeItem(node) {
- while (node && !(node instanceof TreeItem)) {
- node = node.parentNode;
+ function findTreeItem(el) {
+ while (el && !(el instanceof TreeItem)) {
+ el = el.parentNode;
}
- return node;
+ return el;
}
/**
@@ -106,7 +106,7 @@
* @param {Event} e The click event object.
*/
handleClick: function(e) {
- var treeItem = findTreeItem(/** @type {!Node} */(e.target));
+ var treeItem = findTreeItem(e.target);
if (treeItem)
treeItem.handleClick(e);
},
@@ -121,7 +121,7 @@
* @param {Event} e The dblclick event object.
*/
handleDblClick: function(e) {
- var treeItem = findTreeItem(/** @type {!Node} */(e.target));
+ var treeItem = findTreeItem(e.target);
if (treeItem)
treeItem.expanded = !treeItem.expanded;
},
@@ -595,11 +595,11 @@
// Wait for the input element to recieve focus before sizing it.
var rowElement = this.rowElement;
- var onFocus = function() {
+ function onFocus() {
input.removeEventListener('focus', onFocus);
// 20 = the padding and border of the tree-row
cr.ui.limitInputWidth(input, rowElement, 100);
- };
+ }
input.addEventListener('focus', onFocus);
input.focus();
input.select();
@@ -653,8 +653,9 @@
return null;
var nextSibling = item.nextElementSibling;
- if (nextSibling)
- return assertInstanceof(nextSibling, cr.ui.TreeItem);
+ if (nextSibling) {
+ return nextSibling;
+ }
return getNextHelper(item.parentItem);
}
@@ -664,8 +665,7 @@
* @return {cr.ui.TreeItem} The found item or null.
*/
function getPrevious(item) {
- var previousSibling = assertInstanceof(item.previousElementSibling,
- cr.ui.TreeItem);
+ var previousSibling = item.previousElementSibling;
return previousSibling ? getLastHelper(previousSibling) : item.parentItem;
}
« no previous file with comments | « ui/webui/resources/js/cr/ui/touch_handler.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698