Commit 928e16df authored by Dan Beam's avatar Dan Beam Committed by Commit Bot

Local NTP, Realbox: fix console error

R=mahmadi@chromium.org

Fixed: 1013833
Change-Id: I3eac331445d5e76917506f52886a461db484fef3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1857377Reviewed-by: default avatarMoe Ahmadi <mahmadi@chromium.org>
Commit-Queue: Dan Beam <dbeam@chromium.org>
Auto-Submit: Dan Beam <dbeam@chromium.org>
Cr-Commit-Position: refs/heads/master@{#705662}
parent 2a2e9467
......@@ -1494,14 +1494,15 @@ function populateAutocompleteMatches(matches) {
const realboxWrapper = $(IDS.REALBOX_INPUT_WRAPPER);
realboxWrapper.appendChild(realboxMatchesEl);
const hasMatches = matches.length > 0;
realboxWrapper.classList.toggle(CLASSES.SHOW_MATCHES, hasMatches);
if (hasMatches) {
if (matches.length > 0) {
realboxWrapper.classList.add(CLASSES.SHOW_MATCHES);
realboxWrapper.addEventListener('keydown', onRealboxKeyDown);
autocompleteMatches = matches;
} else {
// removesEventListener('keydown', onRealboxKeyDown) and also clears
// |autocompleteMatches|.
hideRealboxMatches();
}
autocompleteMatches = matches;
}
/**
......
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