Use document as root if documentElement is not defined

`nwmatcher` crashes in `jsdom` if `doc.documentElement` is not defined, for example when there is no root `HTML` element (see tmpvar/jsdom#555).

I'm unsure whether this is a bug in `nwmatcher` or `jsdom`, but this fix eliminates it.