Use document.documentElement.cloneNode() when parsing new documents

This lets browsers correctly choose which image to use when using
resolution independent html features such as:

    <img src="image.png" srcset="image@2x.png 2x, image@3x.png 3x">

Without this fix, in many browsers pages loaded through turbolinks
will never show the higher resolution alternatives even when viewed
on retina-like displays.

The reason for this is that browsers based on the latest versions
of both Blink and WebKit (and maybe other engines too) set the
device pixel ratio (DPR) of detached DocumentElements to 1.0. They
only gain a correct DPR when displayed in a browser window, by which
time the choice between multiple resolution images has already been
made.

This affects all existing document creation methods, as they all create
new DocumentElements. Using cloneNode() instead on the existing document
creates a new DocumentElement that inherits its DPR from the currently
displayed page, thereby allowing the correct images to be chosen.
Merge pull request #425 from tomafro/use-clone-node-to-enable-resolution-independence

Use document.documentElement.cloneNode() when parsing to fix resolution independence