Escape on stuck code
Signed-off-by: James Ketrenos <james_git@ketrenos.com>
This commit is contained in:
parent
436524f036
commit
59bbde7e7d
@ -350,18 +350,19 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
var pos = this.checkPosition(index), last = -1;
|
var pos = this.checkPosition(index), last = -1;
|
||||||
while (pos != 0 && last != pos) {
|
while (pos != 0 && last != index) {
|
||||||
|
last = index; /* safety escape in case the DOM changed and nothing matches */
|
||||||
|
|
||||||
if (pos == +1) { /* Checked item was too low on the page, so look closer to start */
|
if (pos == +1) { /* Checked item was too low on the page, so look closer to start */
|
||||||
index = index >> 1;
|
index = index >> 1;
|
||||||
} else { /* Checked item was too high on the page, so look farther */
|
} else { /* Checked item was too high on the page, so look farther */
|
||||||
index += (length - index) >> 1;
|
index += (length - index) >> 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
last = index; /* safety escape in case the DOM changed and nothing matches */
|
|
||||||
pos = this.checkPosition(index);
|
pos = this.checkPosition(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pos == last) {
|
if (pos != 0) {
|
||||||
console.log("DOM changed or viewport changed and search would never exit; re-scheduling check")
|
console.log("DOM changed or viewport changed and search would never exit; re-scheduling check")
|
||||||
//this.triggerVisibilityChecks();
|
//this.triggerVisibilityChecks();
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user