Skip to content

Commit 6d9e2b1

Browse files
author
Raymes Khoury
committed
hterm: Don't print errors resulting from selecting page up/down buttons
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]>
1 parent c0bdfaf commit 6d9e2b1

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

hterm/js/hterm_scrollport.js

+4-6
Original file line numberDiff line numberDiff line change
@@ -225,24 +225,22 @@ hterm.ScrollPort.Selection.prototype.sync = function() {
225225
}
226226

227227
var anchorRow = selection.anchorNode;
228-
while (anchorRow && !('rowIndex' in anchorRow)) {
228+
while (anchorRow && anchorRow.nodeName != 'X-ROW') {
229229
anchorRow = anchorRow.parentNode;
230230
}
231231

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

238237
var focusRow = selection.focusNode;
239-
while (focusRow && !('rowIndex' in focusRow)) {
238+
while (focusRow && focusRow.nodeName != 'X-ROW') {
240239
focusRow = focusRow.parentNode;
241240
}
242241

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

0 commit comments

Comments
 (0)