fix: safari pseudo element content parsing (#2018)

* fix: await for fonts to be ready in document clone

* fix: safari pseudo element content parsing

* fix: safari counter-increment / counter-reset
This commit is contained in:
Niklas von Hertzen
2019-09-27 06:42:13 -07:00
committed by GitHub
parent 076492042a
commit 3f599103fb
3 changed files with 24 additions and 11 deletions

View File

@@ -71,7 +71,7 @@ export class DocumentCloner {
if window url is about:blank, we can assign the url to current by writing onto the document
*/
const iframeLoad = iframeLoader(iframe).then(() => {
const iframeLoad = iframeLoader(iframe).then(async () => {
this.scrolledElements.forEach(restoreNodeScroll);
if (cloneWindow) {
cloneWindow.scrollTo(windowSize.left, windowSize.top);
@@ -91,6 +91,10 @@ export class DocumentCloner {
return Promise.reject(`Error finding the ${this.referenceElement.nodeName} in the cloned document`);
}
if (documentClone.fonts && documentClone.fonts.ready) {
await documentClone.fonts.ready;
}
if (typeof onclone === 'function') {
return Promise.resolve()
.then(() => onclone(documentClone))
@@ -398,7 +402,8 @@ export class DocumentCloner {
);
break;
default:
// console.log('ident', token, declaration);
// safari doesn't parse string tokens correctly because of lack of quotes
anonymousReplacedElement.appendChild(document.createTextNode(token.value));
}
}
});