Fix IE10 support

Turns out IE is the only browser that correctly uses Document for document.
WebKit and Gecko incorrectly uses HTMLDocument (which has been removed from the
specs.)

IE10 + mocha is having some issues. If the tests are run in smaller parts things
work. It seems less agressive invalidation might help as well.