|
|
@@ -263,12 +263,15 @@ this.docHelper = this.docHelper || (() => {
|
|
|
const data = [];
|
|
|
doc.querySelectorAll("img[src]:not([srcset])").forEach((imageElement, imageElementIndex) => {
|
|
|
const computedStyle = win.getComputedStyle(imageElement);
|
|
|
- let imageData = {}, size = getSize(win, imageElement);
|
|
|
- if (imageElement.src && size && (!computedStyle.getPropertyValue("background-image") || computedStyle.getPropertyValue("background-image") == "none")) {
|
|
|
- imageElement.setAttribute(imagesAttributeName(options.sessionId), imageElementIndex);
|
|
|
- imageData = size;
|
|
|
- imageData.objectFit = computedStyle.getPropertyValue("object-fit");
|
|
|
- imageData.objectPosition = computedStyle.getPropertyValue("object-position");
|
|
|
+ let imageData = {};
|
|
|
+ if (computedStyle) {
|
|
|
+ let size = getSize(win, imageElement);
|
|
|
+ if (imageElement.src && size && (!computedStyle.getPropertyValue("background-image") || computedStyle.getPropertyValue("background-image") == "none")) {
|
|
|
+ imageElement.setAttribute(imagesAttributeName(options.sessionId), imageElementIndex);
|
|
|
+ imageData = size;
|
|
|
+ imageData.objectFit = computedStyle.getPropertyValue("object-fit");
|
|
|
+ imageData.objectPosition = computedStyle.getPropertyValue("object-position");
|
|
|
+ }
|
|
|
}
|
|
|
data.push(imageData);
|
|
|
});
|