|
@@ -156,22 +156,29 @@ this.docHelper = this.docHelper || (() => {
|
|
|
const elements = Array.from(element.childNodes).filter(node => !win || node instanceof win.Element);
|
|
const elements = Array.from(element.childNodes).filter(node => !win || node instanceof win.Element);
|
|
|
elements.forEach(element => {
|
|
elements.forEach(element => {
|
|
|
getElementsInfo(win, element, elementsInfo);
|
|
getElementsInfo(win, element, elementsInfo);
|
|
|
- const computedStyle = win.getComputedStyle(element);
|
|
|
|
|
- elementsInfo.set(element, {
|
|
|
|
|
- display: computedStyle.getPropertyValue("display"),
|
|
|
|
|
- opacity: computedStyle.getPropertyValue("opacity"),
|
|
|
|
|
- visibility: computedStyle.getPropertyValue("visibility"),
|
|
|
|
|
- fontFamily: computedStyle.getPropertyValue("font-family"),
|
|
|
|
|
- fontWeight: getFontWeight(computedStyle.getPropertyValue("font-weight")),
|
|
|
|
|
- fontStyle: computedStyle.getPropertyValue("font-style") || "normal",
|
|
|
|
|
- fontVariant: computedStyle.getPropertyValue("font-variant") || "normal",
|
|
|
|
|
- whiteSpace: computedStyle.getPropertyValue("white-space"),
|
|
|
|
|
- shadowRoot: element.shadowRoot
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ setInfo(win, element, elementsInfo);
|
|
|
|
|
+ setInfo(win, element, elementsInfo, "first-letter");
|
|
|
|
|
+ setInfo(win, element, elementsInfo, "before");
|
|
|
|
|
+ setInfo(win, element, elementsInfo, "after");
|
|
|
});
|
|
});
|
|
|
return elementsInfo;
|
|
return elementsInfo;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ function setInfo(win, element, elementsInfo, pseudoElement) {
|
|
|
|
|
+ const computedStyle = win.getComputedStyle(element, pseudoElement);
|
|
|
|
|
+ elementsInfo.set(element, {
|
|
|
|
|
+ display: computedStyle.getPropertyValue("display"),
|
|
|
|
|
+ opacity: computedStyle.getPropertyValue("opacity"),
|
|
|
|
|
+ visibility: computedStyle.getPropertyValue("visibility"),
|
|
|
|
|
+ fontFamily: computedStyle.getPropertyValue("font-family"),
|
|
|
|
|
+ fontWeight: getFontWeight(computedStyle.getPropertyValue("font-weight")),
|
|
|
|
|
+ fontStyle: computedStyle.getPropertyValue("font-style") || "normal",
|
|
|
|
|
+ fontVariant: computedStyle.getPropertyValue("font-variant") || "normal",
|
|
|
|
|
+ whiteSpace: computedStyle.getPropertyValue("white-space"),
|
|
|
|
|
+ shadowRoot: element.shadowRoot
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
function markHiddenCandidates(win, element, styles, elementHidden, removedCandidates, ignoredTags) {
|
|
function markHiddenCandidates(win, element, styles, elementHidden, removedCandidates, ignoredTags) {
|
|
|
const elements = Array.from(element.childNodes).filter(node => node instanceof win.HTMLElement);
|
|
const elements = Array.from(element.childNodes).filter(node => node instanceof win.HTMLElement);
|
|
|
elements.forEach(element => markHiddenCandidates(win, element, styles, elementHidden || testHiddenElement(element, styles.get(element)), removedCandidates, ignoredTags));
|
|
elements.forEach(element => markHiddenCandidates(win, element, styles, elementHidden || testHiddenElement(element, styles.get(element)), removedCandidates, ignoredTags));
|