Fixed passing non-Ranges into Document methods

Fixed regression from b23265ad: ! takes precedence over instanceof.
Merge pull request #1813 from 1ec5/patch-1

Fixed passing non-Ranges into Document methods