The calc_remain_height shouldn't accept nodes that don't have visual representation, like script or style, but it does and it breaks extension on some pages. Here is the corrected version:
function calc_remain_height() {
var rect = null, bottom = null, _point = insert_point;
while (_point) {
if (typeof _point.getBoundingClientRect === 'function') {
rect = _point.getBoundingClientRect();
if (rect && !(rect.top === 0 && rect.right === 0 && rect.bottom === 0 && rect.left === 0)) break;
else rect = null;
}
if (_point.nextSibling) _point = _point.nextSibling;
else break;
}
if (rect) {
bottom = rect.top + window.pageYOffset;
} else if (append_point && typeof append_point.getBoundingClientRect === 'function') {
rect = append_point.getBoundingClientRect();
bottom = rect.top + rect.height + window.pageYOffset;
}
if (!bottom) bottom = Math.round(rootNode.scrollHeight * 0.8);
return rootNode.scrollHeight - bottom + options.BASE_REMAIN_HEIGHT;
}
The
calc_remain_height
shouldn't accept nodes that don't have visual representation, likescript
orstyle
, but it does and it breaks extension on some pages. Here is the corrected version: