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

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

Issue 895283002: Fix Closure Compilation for chrome://downloads and chrome://history (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Node -> Element Created 5 years, 10 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/focus_grid.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/focus_row.js
diff --git a/ui/webui/resources/js/cr/ui/focus_row.js b/ui/webui/resources/js/cr/ui/focus_row.js
index 697cd699c538a60a4c45eff83cafe558fb452cd5..c69d254f7668f6b30c701e76cb736aa42d65b338 100644
--- a/ui/webui/resources/js/cr/ui/focus_row.js
+++ b/ui/webui/resources/js/cr/ui/focus_row.js
@@ -29,6 +29,7 @@ cr.define('cr.ui', function() {
* any focus change deactivates the row.
*
* @constructor
+ * @extends {HTMLDivElement}
*/
function FocusRow() {}
@@ -59,7 +60,8 @@ cr.define('cr.ui', function() {
/**
* Should be called in the constructor to decorate |this|.
* @param {Node} boundary Focus events are ignored outside of this node.
- * @param {FocusRow.Delegate=} opt_delegate A delegate to handle key events.
+ * @param {cr.ui.FocusRow.Delegate=} opt_delegate A delegate to handle key
+ * events.
*/
decorate: function(boundary, opt_delegate) {
/** @private {!Node} */
@@ -90,7 +92,7 @@ cr.define('cr.ui', function() {
* which previously held focus.
* @return {!Element} The element that best matches sampleElement.
*/
- getEquivalentElement: assertNotReached,
+ getEquivalentElement: function(sampleElement) { assertNotReached(); },
/**
* Add an element to this FocusRow. No-op if |element| is not provided.
@@ -148,8 +150,9 @@ cr.define('cr.ui', function() {
* @private
*/
onFocusin_: function(e) {
- if (this.boundary_.contains(assertInstanceof(e.target, Node)))
- this.onFocusChange_(e.target);
+ var target = assertInstanceof(e.target, Element);
+ if (this.boundary_.contains(target))
+ this.onFocusChange_(target);
},
/**
@@ -158,13 +161,14 @@ cr.define('cr.ui', function() {
* @private
*/
onKeydown_: function(e) {
- if (!this.contains(e.target))
+ var element = assertInstanceof(e.target, Element);
+ if (!this.contains(element))
return;
if (this.delegate && this.delegate.onKeydown(this, e))
return;
- var elementIndex = this.focusableElements.indexOf(e.target);
+ var elementIndex = this.focusableElements.indexOf(element);
var index = -1;
if (e.keyIdentifier == 'Left')
@@ -194,7 +198,7 @@ cr.define('cr.ui', function() {
// Only accept the left mouse click.
if (!e.button) {
// Focus this row if the target is one of the elements in this row.
- this.onFocusChange_(e.target);
+ this.onFocusChange_(assertInstanceof(e.target, Element));
}
},
};
« no previous file with comments | « ui/webui/resources/js/cr/ui/focus_grid.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698