diff --git a/src/Clone.js b/src/Clone.js index 22af0c4..4def893 100644 --- a/src/Clone.js +++ b/src/Clone.js @@ -614,7 +614,7 @@ export const cloneWindow = ( }); documentClone.open(); - documentClone.write(''); + documentClone.write(`${serializeDoctype(document.doctype)}`); // Chrome scrolls the parent document for some reason after the write to the cloned window??? restoreOwnerScroll(referenceElement.ownerDocument, scrollX, scrollY); documentClone.replaceChild( @@ -626,3 +626,29 @@ export const cloneWindow = ( return iframeLoad; }); }; + +const serializeDoctype = (doctype: ?DocumentType): string => { + let str = ''; + if (doctype) { + str += ''; + } + + return str; +}; diff --git a/tests/reftests/images/doctype.html b/tests/reftests/images/doctype.html new file mode 100644 index 0000000..76f06ea --- /dev/null +++ b/tests/reftests/images/doctype.html @@ -0,0 +1,11 @@ + + + + + + + + +
+ +