Skip to content
This repository has been archived by the owner on Sep 1, 2023. It is now read-only.
/ hterm Public archive

Commit

Permalink
hterm: Don't print errors resulting from selecting page up/down buttons
Browse files Browse the repository at this point in the history
Currently errors will be printed when page up/down are selected because
ScrollPort.Selection.sync only expects to be dealing with <x-row> nodes.
This adds a check to ignore these buttons.

Bug: 822490, 646690
Change-Id: Ida699c5c475555f7616d1f748a459523c960564b
Reviewed-on: https://chromium-review.googlesource.com/1078127
Reviewed-by: Mike Frysinger <[email protected]>
Tested-by: Raymes Khoury <[email protected]>
  • Loading branch information
Raymes Khoury committed Jun 20, 2018
1 parent 7ba0c1f commit 05e93a8
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions js/hterm_scrollport.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,24 +225,22 @@ hterm.ScrollPort.Selection.prototype.sync = function() {
}

var anchorRow = selection.anchorNode;
while (anchorRow && !('rowIndex' in anchorRow)) {
while (anchorRow && anchorRow.nodeName != 'X-ROW') {
anchorRow = anchorRow.parentNode;
}

if (!anchorRow) {
console.error('Selection anchor is not rooted in a row node: ' +
selection.anchorNode.nodeName);
// Don't set a selection if it's not a row node that's selected.
return;
}

var focusRow = selection.focusNode;
while (focusRow && !('rowIndex' in focusRow)) {
while (focusRow && focusRow.nodeName != 'X-ROW') {
focusRow = focusRow.parentNode;
}

if (!focusRow) {
console.error('Selection focus is not rooted in a row node: ' +
selection.focusNode.nodeName);
// Don't set a selection if it's not a row node that's selected.
return;
}

Expand Down

0 comments on commit 05e93a8

Please sign in to comment.