|
@@ -141,7 +141,11 @@ function preProcessDoc(doc, win, options) {
|
|
|
invalidElements.set(element, placeHolderElement);
|
|
invalidElements.set(element, placeHolderElement);
|
|
|
element.replaceWith(placeHolderElement);
|
|
element.replaceWith(placeHolderElement);
|
|
|
});
|
|
});
|
|
|
- elementsInfo = getElementsInfo(win, doc, doc.documentElement, options);
|
|
|
|
|
|
|
+ try {
|
|
|
|
|
+ elementsInfo = getElementsInfo(win, doc, doc.documentElement, options);
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ debugger;
|
|
|
|
|
+ }
|
|
|
if (options.moveStylesInHead) {
|
|
if (options.moveStylesInHead) {
|
|
|
doc.querySelectorAll("body style, body ~ style").forEach(element => {
|
|
doc.querySelectorAll("body style, body ~ style").forEach(element => {
|
|
|
const computedStyle = win.getComputedStyle(element);
|
|
const computedStyle = win.getComputedStyle(element);
|
|
@@ -224,8 +228,12 @@ function getElementsInfo(win, doc, element, options, data = { usedFonts: new Map
|
|
|
shadowRootInfo.content = shadowRoot.innerHTML;
|
|
shadowRootInfo.content = shadowRoot.innerHTML;
|
|
|
shadowRootInfo.delegatesFocus = shadowRoot.delegatesFocus;
|
|
shadowRootInfo.delegatesFocus = shadowRoot.delegatesFocus;
|
|
|
shadowRootInfo.mode = shadowRoot.mode;
|
|
shadowRootInfo.mode = shadowRoot.mode;
|
|
|
- if (shadowRoot.adoptedStyleSheets && shadowRoot.adoptedStyleSheets.length) {
|
|
|
|
|
- shadowRootInfo.adoptedStyleSheets = Array.from(shadowRoot.adoptedStyleSheets).map(stylesheet => Array.from(stylesheet.cssRules).map(cssRule => cssRule.cssText).join("\n"));
|
|
|
|
|
|
|
+ try {
|
|
|
|
|
+ if (shadowRoot.adoptedStyleSheets && shadowRoot.adoptedStyleSheets.length) {
|
|
|
|
|
+ shadowRootInfo.adoptedStyleSheets = Array.from(shadowRoot.adoptedStyleSheets).map(stylesheet => Array.from(stylesheet.cssRules).map(cssRule => cssRule.cssText).join("\n"));
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ // ignored
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
getElementsInfo(win, doc, element, options, data, elementHidden);
|
|
getElementsInfo(win, doc, element, options, data, elementHidden);
|