Why do that calculation (subtraction) and then ignore it?

    return window.scrollMaxY || (docElem.scrollHeight - window.innerHeight);