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

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

Issue 543863002: Typecheck chrome://bookmarks using Closure Compiler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@true_master
Patch Set: revert checker.py 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
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 04f978ebf72ddc4a01a85b31d47ab5e6c90dc452..39d084ba58e00f3aa4ccf001ffd8d58cd4673646 100644
--- a/ui/webui/resources/js/cr/ui/tree.js
+++ b/ui/webui/resources/js/cr/ui/tree.js
@@ -24,14 +24,14 @@ cr.define('cr.ui', function() {
/**
* Helper function that finds the first ancestor tree item.
- * @param {!Element} el The element to start searching from.
+ * @param {Node} node The node to start searching from.
* @return {cr.ui.TreeItem} The found tree item or null if not found.
*/
- function findTreeItem(el) {
- while (el && !(el instanceof TreeItem)) {
- el = el.parentNode;
+ function findTreeItem(node) {
+ while (node && !(node instanceof TreeItem)) {
+ node = node.parentNode;
}
- return el;
+ return node;
}
/**
@@ -106,7 +106,7 @@ cr.define('cr.ui', function() {
* @param {Event} e The click event object.
*/
handleClick: function(e) {
- var treeItem = findTreeItem(e.target);
+ var treeItem = findTreeItem(/** @type {!Node} */(e.target));
if (treeItem)
treeItem.handleClick(e);
},
@@ -121,7 +121,7 @@ cr.define('cr.ui', function() {
* @param {Event} e The dblclick event object.
*/
handleDblClick: function(e) {
- var treeItem = findTreeItem(e.target);
+ var treeItem = findTreeItem(/** @type {!Node} */(e.target));
if (treeItem)
treeItem.expanded = !treeItem.expanded;
},
@@ -595,7 +595,7 @@ cr.define('cr.ui', function() {
// Wait for the input element to recieve focus before sizing it.
var rowElement = this.rowElement;
- function onFocus() {
+ var onFocus = function() {
Dan Beam 2014/09/23 02:46:56 why this change? also, ; after function expressio
Vitaly Pavlenko 2014/09/23 22:20:55 Why: ERROR - functions can only be declared at top
input.removeEventListener('focus', onFocus);
// 20 = the padding and border of the tree-row
cr.ui.limitInputWidth(input, rowElement, 100);
@@ -654,7 +654,7 @@ cr.define('cr.ui', function() {
var nextSibling = item.nextElementSibling;
if (nextSibling) {
Dan Beam 2014/09/23 02:46:56 nit: no curlies
Vitaly Pavlenko 2014/09/23 22:20:56 Done.
- return nextSibling;
+ return assertInstanceof(nextSibling, cr.ui.TreeItem);
}
return getNextHelper(item.parentItem);
}
@@ -665,7 +665,8 @@ cr.define('cr.ui', function() {
* @return {cr.ui.TreeItem} The found item or null.
*/
function getPrevious(item) {
- var previousSibling = item.previousElementSibling;
+ var previousSibling = assertInstanceof(item.previousElementSibling,
+ cr.ui.TreeItem);
return previousSibling ? getLastHelper(previousSibling) : item.parentItem;
}
« ui/webui/resources/js/cr/ui/touch_handler.js ('K') | « 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