Fixes #8 by explicitly checking the roots of various arguments.

Also made the definitions of setBaseAndExtent and containsNode more precise
by refer to the concept of root instead of simply stating that nodes need
to be in the "same document" as the range's associated document.