Commit bfe8098d authored by Luciano Pacheco's avatar Luciano Pacheco Committed by Chromium LUCI CQ

WebUI: Fix cr.ui.List as JS module

When running as JS module which is strict by default, the code fails to
assign to `e.target`.  Fix this by declaring a local variable `target`
with the desired Closure type markup.

Bug: 1133186
Change-Id: I5033eae87310e4eebdae2e2b22487df8ffc01a19
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2636904
Commit-Queue: calamity <calamity@chromium.org>
Reviewed-by: default avatarcalamity <calamity@chromium.org>
Auto-Submit: Luciano Pacheco <lucmult@chromium.org>
Cr-Commit-Position: refs/heads/master@{#845047}
parent 587406c6
......@@ -1399,8 +1399,8 @@ cr.define('cr.ui', function() {
* @param {Event} e The mouse event object.
*/
function handleMouseDown(e) {
e.target = /** @type {!HTMLElement} */ (e.target);
const listItem = this.getListItemAncestor(e.target);
const target = /** @type {!HTMLElement} */ (e.target);
const listItem = this.getListItemAncestor(target);
const wasSelected = listItem && listItem.selected;
this.handlePointerDownUp_(e);
......@@ -1419,7 +1419,7 @@ cr.define('cr.ui', function() {
//
// [1] For example, clicking non-focusable area gives focus on the first
// form control in the item.
if (!containsFocusableElement(e.target, listItem) &&
if (!containsFocusableElement(target, listItem) &&
listItem.contains(listItem.ownerDocument.activeElement)) {
e.preventDefault();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment