@applitools/dom-snapshot
Advanced tools
Comparing version 1.2.24 to 1.3.1
@@ -1,2 +0,2 @@ | ||
// @applitools/dom-snapshot@1.2.24 | ||
// @applitools/dom-snapshot@1.3.1 | ||
function __processPage() { | ||
@@ -7,3 +7,3 @@ var processPage = (function () { | ||
function extractLinks(doc = document) { | ||
const srcsetUrls = [...doc.querySelectorAll('img[srcset],source[srcset]')] | ||
const srcsetUrls = Array.from(doc.querySelectorAll('img[srcset],source[srcset]')) | ||
.map(srcsetEl => | ||
@@ -17,23 +17,28 @@ srcsetEl | ||
const srcUrls = [...doc.querySelectorAll('img[src],source[src]')].map(srcEl => | ||
const srcUrls = Array.from(doc.querySelectorAll('img[src],source[src]')).map(srcEl => | ||
srcEl.getAttribute('src'), | ||
); | ||
const imageUrls = [...doc.querySelectorAll('image,use')] | ||
const imageUrls = Array.from(doc.querySelectorAll('image,use')) | ||
.map(hrefEl => hrefEl.getAttribute('href') || hrefEl.getAttribute('xlink:href')) | ||
.filter(u => u && u[0] !== '#'); | ||
const objectUrls = [...doc.querySelectorAll('object')] | ||
const objectUrls = Array.from(doc.querySelectorAll('object')) | ||
.map(el => el.getAttribute('data')) | ||
.filter(Boolean); | ||
const cssUrls = [...doc.querySelectorAll('link[rel="stylesheet"]')].map(link => | ||
const cssUrls = Array.from(doc.querySelectorAll('link[rel="stylesheet"]')).map(link => | ||
link.getAttribute('href'), | ||
); | ||
const videoPosterUrls = [...doc.querySelectorAll('video[poster]')].map(videoEl => | ||
const videoPosterUrls = Array.from(doc.querySelectorAll('video[poster]')).map(videoEl => | ||
videoEl.getAttribute('poster'), | ||
); | ||
return [...srcsetUrls, ...srcUrls, ...imageUrls, ...cssUrls, ...videoPosterUrls, ...objectUrls]; | ||
return Array.from(srcsetUrls) | ||
.concat(Array.from(srcUrls)) | ||
.concat(Array.from(imageUrls)) | ||
.concat(Array.from(cssUrls)) | ||
.concat(Array.from(videoPosterUrls)) | ||
.concat(Array.from(objectUrls)); | ||
} | ||
@@ -46,13 +51,5 @@ | ||
function domNodesToCdt(docNode) { | ||
const NODE_TYPES = { | ||
ELEMENT: 1, | ||
TEXT: 3, | ||
DOCUMENT: 9, | ||
DOCUMENT_TYPE: 10, | ||
DOCUMENT_FRAGMENT_NODE: 11, | ||
}; | ||
const cdt = [ | ||
{ | ||
nodeType: NODE_TYPES.DOCUMENT, | ||
nodeType: Node.DOCUMENT_NODE, | ||
}, | ||
@@ -68,3 +65,3 @@ ]; | ||
const childIndexes = []; | ||
elementNodes.forEach(elementNode => { | ||
Array.prototype.forEach.call(elementNodes, elementNode => { | ||
const index = elementNodeFactory(domNodes, documents, elementNode); | ||
@@ -82,3 +79,3 @@ if (index !== null) { | ||
const {nodeType} = elementNode; | ||
if ([NODE_TYPES.ELEMENT, NODE_TYPES.DOCUMENT_FRAGMENT_NODE].includes(nodeType)) { | ||
if ([Node.ELEMENT_NODE, Node.DOCUMENT_FRAGMENT_NODE].includes(nodeType)) { | ||
if (elementNode.nodeName !== 'SCRIPT') { | ||
@@ -91,4 +88,6 @@ if ( | ||
domNodes.push({ | ||
nodeType: NODE_TYPES.TEXT, | ||
nodeValue: [...elementNode.sheet.cssRules].map(rule => rule.cssText).join(''), | ||
nodeType: Node.TEXT_NODE, | ||
nodeValue: Array.from(elementNode.sheet.cssRules) | ||
.map(rule => rule.cssText) | ||
.join(''), | ||
}); | ||
@@ -144,3 +143,3 @@ manualChildNodeIndexes = [domNodes.length - 1]; | ||
node = { | ||
nodeType: NODE_TYPES.ELEMENT, | ||
nodeType: Node.ELEMENT_NODE, | ||
nodeName: 'SCRIPT', | ||
@@ -156,10 +155,10 @@ attributes: nodeAttributes(elementNode) | ||
} | ||
} else if (nodeType === NODE_TYPES.TEXT) { | ||
} else if (nodeType === Node.TEXT_NODE) { | ||
node = { | ||
nodeType: NODE_TYPES.TEXT, | ||
nodeType: Node.TEXT_NODE, | ||
nodeValue: elementNode.nodeValue, | ||
}; | ||
} else if (nodeType === NODE_TYPES.DOCUMENT_TYPE) { | ||
} else if (nodeType === Node.DOCUMENT_TYPE_NODE) { | ||
node = { | ||
nodeType: NODE_TYPES.DOCUMENT_TYPE, | ||
nodeType: Node.DOCUMENT_TYPE_NODE, | ||
nodeName: elementNode.nodeName, | ||
@@ -178,3 +177,3 @@ }; | ||
function nodeAttributes({attributes = {}}) { | ||
return Object.keys(attributes).filter(k => attributes[k].name); | ||
return Object.keys(attributes).filter(k => attributes[k] && attributes[k].name); | ||
} | ||
@@ -185,9 +184,2 @@ } | ||
var domNodesToCdt_1 = domNodesToCdt; | ||
var NODE_TYPES = { | ||
ELEMENT: 1, | ||
TEXT: 3, | ||
DOCUMENT: 9, | ||
DOCUMENT_TYPE: 10, | ||
}; | ||
domNodesToCdt_1.NODE_TYPES = NODE_TYPES; | ||
@@ -201,3 +193,5 @@ function flat(arr) { | ||
function extractFrames(documents = [document]) { | ||
const iframes = flat_1(documents.map(d => [...d.querySelectorAll('iframe[src]:not([src=""])')])); | ||
const iframes = flat_1( | ||
documents.map(d => Array.from(d.querySelectorAll('iframe[src]:not([src=""])'))), | ||
); | ||
return iframes | ||
@@ -330,3 +324,5 @@ .map(srcEl => { | ||
function probablyCORS(err, url) { | ||
const msgCORS = err.message && err.message.includes('Failed to fetch'); | ||
const msgCORS = | ||
err.message && | ||
(err.message.includes('Failed to fetch') || err.message.includes('Network request failed')); | ||
const nameCORS = err.name && err.name.includes('TypeError'); | ||
@@ -356,3 +352,3 @@ return msgCORS && nameCORS && !isSameOrigin(url, baseUrl); | ||
); | ||
urls = [...fromImages, ...fromObjects].filter(u => u[0] !== '#'); | ||
urls = fromImages.concat(fromObjects).filter(u => u[0] !== '#'); | ||
} catch (e) { | ||
@@ -385,3 +381,3 @@ console.log('could not parse svg content', e); | ||
return function findStyleSheetByUrl(url, documents) { | ||
const allStylesheets = flat_1(documents.map(d => [...d.styleSheets])); | ||
const allStylesheets = flat_1(documents.map(d => Array.from(d.styleSheets))); | ||
return ( | ||
@@ -412,3 +408,3 @@ styleSheetCache[url] || | ||
return uniq_1( | ||
[...(styleSheet.cssRules || [])].reduce((acc, rule) => { | ||
Array.from(styleSheet.cssRules || []).reduce((acc, rule) => { | ||
if (rule instanceof win.CSSImportRule) { | ||
@@ -418,4 +414,7 @@ styleSheetCache[rule.styleSheet.href] = rule.styleSheet; | ||
} else if (rule instanceof win.CSSFontFaceRule) { | ||
return acc.concat(getUrlFromCssText_1(rule.style.getPropertyValue('src'))); | ||
} else if (rule instanceof win.CSSSupportsRule || rule instanceof win.CSSMediaRule) { | ||
return acc.concat(getUrlFromCssText_1(rule.cssText)); | ||
} else if ( | ||
(win.CSSSupportsRule && rule instanceof win.CSSSupportsRule) || | ||
rule instanceof win.CSSMediaRule | ||
) { | ||
return acc.concat(extractResourcesFromStyleSheet(rule)); | ||
@@ -453,4 +452,4 @@ } else if (rule instanceof win.CSSStyleRule) { | ||
return uniq_1( | ||
[...doc.querySelectorAll('style')].reduce((resourceUrls, styleEl) => { | ||
const styleSheet = [...doc.styleSheets].find( | ||
Array.from(doc.querySelectorAll('style')).reduce((resourceUrls, styleEl) => { | ||
const styleSheet = Array.from(doc.styleSheets).find( | ||
styleSheet => styleSheet.ownerNode === styleEl, | ||
@@ -526,3 +525,7 @@ ); | ||
const styleTagUrls = flat_1(documents.map(extractResourceUrlsFromStyleTags$$1)); | ||
const links = uniq_1([...linkUrls, ...styleTagUrls, ...extractResourceUrlsFromStyleAttrs_1(cdt)]) | ||
const links = uniq_1( | ||
Array.from(linkUrls) | ||
.concat(Array.from(styleTagUrls)) | ||
.concat(extractResourceUrlsFromStyleAttrs_1(cdt)), | ||
) | ||
.map(toUnAnchoredUri_1) | ||
@@ -529,0 +532,0 @@ .map(toUriEncoding_1) |
@@ -1,2 +0,2 @@ | ||
// @applitools/dom-snapshot@1.2.24 | ||
// @applitools/dom-snapshot@1.3.1 | ||
function __processPageAndPoll() { | ||
@@ -59,3 +59,3 @@ var processPageAndPoll = (function () { | ||
function extractLinks(doc = document) { | ||
const srcsetUrls = [...doc.querySelectorAll('img[srcset],source[srcset]')] | ||
const srcsetUrls = Array.from(doc.querySelectorAll('img[srcset],source[srcset]')) | ||
.map(srcsetEl => | ||
@@ -69,23 +69,28 @@ srcsetEl | ||
const srcUrls = [...doc.querySelectorAll('img[src],source[src]')].map(srcEl => | ||
const srcUrls = Array.from(doc.querySelectorAll('img[src],source[src]')).map(srcEl => | ||
srcEl.getAttribute('src'), | ||
); | ||
const imageUrls = [...doc.querySelectorAll('image,use')] | ||
const imageUrls = Array.from(doc.querySelectorAll('image,use')) | ||
.map(hrefEl => hrefEl.getAttribute('href') || hrefEl.getAttribute('xlink:href')) | ||
.filter(u => u && u[0] !== '#'); | ||
const objectUrls = [...doc.querySelectorAll('object')] | ||
const objectUrls = Array.from(doc.querySelectorAll('object')) | ||
.map(el => el.getAttribute('data')) | ||
.filter(Boolean); | ||
const cssUrls = [...doc.querySelectorAll('link[rel="stylesheet"]')].map(link => | ||
const cssUrls = Array.from(doc.querySelectorAll('link[rel="stylesheet"]')).map(link => | ||
link.getAttribute('href'), | ||
); | ||
const videoPosterUrls = [...doc.querySelectorAll('video[poster]')].map(videoEl => | ||
const videoPosterUrls = Array.from(doc.querySelectorAll('video[poster]')).map(videoEl => | ||
videoEl.getAttribute('poster'), | ||
); | ||
return [...srcsetUrls, ...srcUrls, ...imageUrls, ...cssUrls, ...videoPosterUrls, ...objectUrls]; | ||
return Array.from(srcsetUrls) | ||
.concat(Array.from(srcUrls)) | ||
.concat(Array.from(imageUrls)) | ||
.concat(Array.from(cssUrls)) | ||
.concat(Array.from(videoPosterUrls)) | ||
.concat(Array.from(objectUrls)); | ||
} | ||
@@ -98,13 +103,5 @@ | ||
function domNodesToCdt(docNode) { | ||
const NODE_TYPES = { | ||
ELEMENT: 1, | ||
TEXT: 3, | ||
DOCUMENT: 9, | ||
DOCUMENT_TYPE: 10, | ||
DOCUMENT_FRAGMENT_NODE: 11, | ||
}; | ||
const cdt = [ | ||
{ | ||
nodeType: NODE_TYPES.DOCUMENT, | ||
nodeType: Node.DOCUMENT_NODE, | ||
}, | ||
@@ -120,3 +117,3 @@ ]; | ||
const childIndexes = []; | ||
elementNodes.forEach(elementNode => { | ||
Array.prototype.forEach.call(elementNodes, elementNode => { | ||
const index = elementNodeFactory(domNodes, documents, elementNode); | ||
@@ -134,3 +131,3 @@ if (index !== null) { | ||
const {nodeType} = elementNode; | ||
if ([NODE_TYPES.ELEMENT, NODE_TYPES.DOCUMENT_FRAGMENT_NODE].includes(nodeType)) { | ||
if ([Node.ELEMENT_NODE, Node.DOCUMENT_FRAGMENT_NODE].includes(nodeType)) { | ||
if (elementNode.nodeName !== 'SCRIPT') { | ||
@@ -143,4 +140,6 @@ if ( | ||
domNodes.push({ | ||
nodeType: NODE_TYPES.TEXT, | ||
nodeValue: [...elementNode.sheet.cssRules].map(rule => rule.cssText).join(''), | ||
nodeType: Node.TEXT_NODE, | ||
nodeValue: Array.from(elementNode.sheet.cssRules) | ||
.map(rule => rule.cssText) | ||
.join(''), | ||
}); | ||
@@ -196,3 +195,3 @@ manualChildNodeIndexes = [domNodes.length - 1]; | ||
node = { | ||
nodeType: NODE_TYPES.ELEMENT, | ||
nodeType: Node.ELEMENT_NODE, | ||
nodeName: 'SCRIPT', | ||
@@ -208,10 +207,10 @@ attributes: nodeAttributes(elementNode) | ||
} | ||
} else if (nodeType === NODE_TYPES.TEXT) { | ||
} else if (nodeType === Node.TEXT_NODE) { | ||
node = { | ||
nodeType: NODE_TYPES.TEXT, | ||
nodeType: Node.TEXT_NODE, | ||
nodeValue: elementNode.nodeValue, | ||
}; | ||
} else if (nodeType === NODE_TYPES.DOCUMENT_TYPE) { | ||
} else if (nodeType === Node.DOCUMENT_TYPE_NODE) { | ||
node = { | ||
nodeType: NODE_TYPES.DOCUMENT_TYPE, | ||
nodeType: Node.DOCUMENT_TYPE_NODE, | ||
nodeName: elementNode.nodeName, | ||
@@ -230,3 +229,3 @@ }; | ||
function nodeAttributes({attributes = {}}) { | ||
return Object.keys(attributes).filter(k => attributes[k].name); | ||
return Object.keys(attributes).filter(k => attributes[k] && attributes[k].name); | ||
} | ||
@@ -237,9 +236,2 @@ } | ||
var domNodesToCdt_1 = domNodesToCdt; | ||
var NODE_TYPES = { | ||
ELEMENT: 1, | ||
TEXT: 3, | ||
DOCUMENT: 9, | ||
DOCUMENT_TYPE: 10, | ||
}; | ||
domNodesToCdt_1.NODE_TYPES = NODE_TYPES; | ||
@@ -253,3 +245,5 @@ function flat(arr) { | ||
function extractFrames(documents = [document]) { | ||
const iframes = flat_1(documents.map(d => [...d.querySelectorAll('iframe[src]:not([src=""])')])); | ||
const iframes = flat_1( | ||
documents.map(d => Array.from(d.querySelectorAll('iframe[src]:not([src=""])'))), | ||
); | ||
return iframes | ||
@@ -382,3 +376,5 @@ .map(srcEl => { | ||
function probablyCORS(err, url) { | ||
const msgCORS = err.message && err.message.includes('Failed to fetch'); | ||
const msgCORS = | ||
err.message && | ||
(err.message.includes('Failed to fetch') || err.message.includes('Network request failed')); | ||
const nameCORS = err.name && err.name.includes('TypeError'); | ||
@@ -408,3 +404,3 @@ return msgCORS && nameCORS && !isSameOrigin(url, baseUrl); | ||
); | ||
urls = [...fromImages, ...fromObjects].filter(u => u[0] !== '#'); | ||
urls = fromImages.concat(fromObjects).filter(u => u[0] !== '#'); | ||
} catch (e) { | ||
@@ -437,3 +433,3 @@ console.log('could not parse svg content', e); | ||
return function findStyleSheetByUrl(url, documents) { | ||
const allStylesheets = flat_1(documents.map(d => [...d.styleSheets])); | ||
const allStylesheets = flat_1(documents.map(d => Array.from(d.styleSheets))); | ||
return ( | ||
@@ -464,3 +460,3 @@ styleSheetCache[url] || | ||
return uniq_1( | ||
[...(styleSheet.cssRules || [])].reduce((acc, rule) => { | ||
Array.from(styleSheet.cssRules || []).reduce((acc, rule) => { | ||
if (rule instanceof win.CSSImportRule) { | ||
@@ -470,4 +466,7 @@ styleSheetCache[rule.styleSheet.href] = rule.styleSheet; | ||
} else if (rule instanceof win.CSSFontFaceRule) { | ||
return acc.concat(getUrlFromCssText_1(rule.style.getPropertyValue('src'))); | ||
} else if (rule instanceof win.CSSSupportsRule || rule instanceof win.CSSMediaRule) { | ||
return acc.concat(getUrlFromCssText_1(rule.cssText)); | ||
} else if ( | ||
(win.CSSSupportsRule && rule instanceof win.CSSSupportsRule) || | ||
rule instanceof win.CSSMediaRule | ||
) { | ||
return acc.concat(extractResourcesFromStyleSheet(rule)); | ||
@@ -505,4 +504,4 @@ } else if (rule instanceof win.CSSStyleRule) { | ||
return uniq_1( | ||
[...doc.querySelectorAll('style')].reduce((resourceUrls, styleEl) => { | ||
const styleSheet = [...doc.styleSheets].find( | ||
Array.from(doc.querySelectorAll('style')).reduce((resourceUrls, styleEl) => { | ||
const styleSheet = Array.from(doc.styleSheets).find( | ||
styleSheet => styleSheet.ownerNode === styleEl, | ||
@@ -578,3 +577,7 @@ ); | ||
const styleTagUrls = flat_1(documents.map(extractResourceUrlsFromStyleTags$$1)); | ||
const links = uniq_1([...linkUrls, ...styleTagUrls, ...extractResourceUrlsFromStyleAttrs_1(cdt)]) | ||
const links = uniq_1( | ||
Array.from(linkUrls) | ||
.concat(Array.from(styleTagUrls)) | ||
.concat(extractResourceUrlsFromStyleAttrs_1(cdt)), | ||
) | ||
.map(toUnAnchoredUri_1) | ||
@@ -581,0 +584,0 @@ .map(toUriEncoding_1) |
@@ -1,2 +0,2 @@ | ||
// @applitools/dom-snapshot@1.2.24 | ||
// @applitools/dom-snapshot@1.3.1 | ||
function __processPageAndSerialize() { | ||
@@ -59,3 +59,3 @@ var processPageAndSerialize = (function () { | ||
function extractLinks(doc = document) { | ||
const srcsetUrls = [...doc.querySelectorAll('img[srcset],source[srcset]')] | ||
const srcsetUrls = Array.from(doc.querySelectorAll('img[srcset],source[srcset]')) | ||
.map(srcsetEl => | ||
@@ -69,23 +69,28 @@ srcsetEl | ||
const srcUrls = [...doc.querySelectorAll('img[src],source[src]')].map(srcEl => | ||
const srcUrls = Array.from(doc.querySelectorAll('img[src],source[src]')).map(srcEl => | ||
srcEl.getAttribute('src'), | ||
); | ||
const imageUrls = [...doc.querySelectorAll('image,use')] | ||
const imageUrls = Array.from(doc.querySelectorAll('image,use')) | ||
.map(hrefEl => hrefEl.getAttribute('href') || hrefEl.getAttribute('xlink:href')) | ||
.filter(u => u && u[0] !== '#'); | ||
const objectUrls = [...doc.querySelectorAll('object')] | ||
const objectUrls = Array.from(doc.querySelectorAll('object')) | ||
.map(el => el.getAttribute('data')) | ||
.filter(Boolean); | ||
const cssUrls = [...doc.querySelectorAll('link[rel="stylesheet"]')].map(link => | ||
const cssUrls = Array.from(doc.querySelectorAll('link[rel="stylesheet"]')).map(link => | ||
link.getAttribute('href'), | ||
); | ||
const videoPosterUrls = [...doc.querySelectorAll('video[poster]')].map(videoEl => | ||
const videoPosterUrls = Array.from(doc.querySelectorAll('video[poster]')).map(videoEl => | ||
videoEl.getAttribute('poster'), | ||
); | ||
return [...srcsetUrls, ...srcUrls, ...imageUrls, ...cssUrls, ...videoPosterUrls, ...objectUrls]; | ||
return Array.from(srcsetUrls) | ||
.concat(Array.from(srcUrls)) | ||
.concat(Array.from(imageUrls)) | ||
.concat(Array.from(cssUrls)) | ||
.concat(Array.from(videoPosterUrls)) | ||
.concat(Array.from(objectUrls)); | ||
} | ||
@@ -98,13 +103,5 @@ | ||
function domNodesToCdt(docNode) { | ||
const NODE_TYPES = { | ||
ELEMENT: 1, | ||
TEXT: 3, | ||
DOCUMENT: 9, | ||
DOCUMENT_TYPE: 10, | ||
DOCUMENT_FRAGMENT_NODE: 11, | ||
}; | ||
const cdt = [ | ||
{ | ||
nodeType: NODE_TYPES.DOCUMENT, | ||
nodeType: Node.DOCUMENT_NODE, | ||
}, | ||
@@ -120,3 +117,3 @@ ]; | ||
const childIndexes = []; | ||
elementNodes.forEach(elementNode => { | ||
Array.prototype.forEach.call(elementNodes, elementNode => { | ||
const index = elementNodeFactory(domNodes, documents, elementNode); | ||
@@ -134,3 +131,3 @@ if (index !== null) { | ||
const {nodeType} = elementNode; | ||
if ([NODE_TYPES.ELEMENT, NODE_TYPES.DOCUMENT_FRAGMENT_NODE].includes(nodeType)) { | ||
if ([Node.ELEMENT_NODE, Node.DOCUMENT_FRAGMENT_NODE].includes(nodeType)) { | ||
if (elementNode.nodeName !== 'SCRIPT') { | ||
@@ -143,4 +140,6 @@ if ( | ||
domNodes.push({ | ||
nodeType: NODE_TYPES.TEXT, | ||
nodeValue: [...elementNode.sheet.cssRules].map(rule => rule.cssText).join(''), | ||
nodeType: Node.TEXT_NODE, | ||
nodeValue: Array.from(elementNode.sheet.cssRules) | ||
.map(rule => rule.cssText) | ||
.join(''), | ||
}); | ||
@@ -196,3 +195,3 @@ manualChildNodeIndexes = [domNodes.length - 1]; | ||
node = { | ||
nodeType: NODE_TYPES.ELEMENT, | ||
nodeType: Node.ELEMENT_NODE, | ||
nodeName: 'SCRIPT', | ||
@@ -208,10 +207,10 @@ attributes: nodeAttributes(elementNode) | ||
} | ||
} else if (nodeType === NODE_TYPES.TEXT) { | ||
} else if (nodeType === Node.TEXT_NODE) { | ||
node = { | ||
nodeType: NODE_TYPES.TEXT, | ||
nodeType: Node.TEXT_NODE, | ||
nodeValue: elementNode.nodeValue, | ||
}; | ||
} else if (nodeType === NODE_TYPES.DOCUMENT_TYPE) { | ||
} else if (nodeType === Node.DOCUMENT_TYPE_NODE) { | ||
node = { | ||
nodeType: NODE_TYPES.DOCUMENT_TYPE, | ||
nodeType: Node.DOCUMENT_TYPE_NODE, | ||
nodeName: elementNode.nodeName, | ||
@@ -230,3 +229,3 @@ }; | ||
function nodeAttributes({attributes = {}}) { | ||
return Object.keys(attributes).filter(k => attributes[k].name); | ||
return Object.keys(attributes).filter(k => attributes[k] && attributes[k].name); | ||
} | ||
@@ -237,9 +236,2 @@ } | ||
var domNodesToCdt_1 = domNodesToCdt; | ||
var NODE_TYPES = { | ||
ELEMENT: 1, | ||
TEXT: 3, | ||
DOCUMENT: 9, | ||
DOCUMENT_TYPE: 10, | ||
}; | ||
domNodesToCdt_1.NODE_TYPES = NODE_TYPES; | ||
@@ -253,3 +245,5 @@ function flat(arr) { | ||
function extractFrames(documents = [document]) { | ||
const iframes = flat_1(documents.map(d => [...d.querySelectorAll('iframe[src]:not([src=""])')])); | ||
const iframes = flat_1( | ||
documents.map(d => Array.from(d.querySelectorAll('iframe[src]:not([src=""])'))), | ||
); | ||
return iframes | ||
@@ -382,3 +376,5 @@ .map(srcEl => { | ||
function probablyCORS(err, url) { | ||
const msgCORS = err.message && err.message.includes('Failed to fetch'); | ||
const msgCORS = | ||
err.message && | ||
(err.message.includes('Failed to fetch') || err.message.includes('Network request failed')); | ||
const nameCORS = err.name && err.name.includes('TypeError'); | ||
@@ -408,3 +404,3 @@ return msgCORS && nameCORS && !isSameOrigin(url, baseUrl); | ||
); | ||
urls = [...fromImages, ...fromObjects].filter(u => u[0] !== '#'); | ||
urls = fromImages.concat(fromObjects).filter(u => u[0] !== '#'); | ||
} catch (e) { | ||
@@ -437,3 +433,3 @@ console.log('could not parse svg content', e); | ||
return function findStyleSheetByUrl(url, documents) { | ||
const allStylesheets = flat_1(documents.map(d => [...d.styleSheets])); | ||
const allStylesheets = flat_1(documents.map(d => Array.from(d.styleSheets))); | ||
return ( | ||
@@ -464,3 +460,3 @@ styleSheetCache[url] || | ||
return uniq_1( | ||
[...(styleSheet.cssRules || [])].reduce((acc, rule) => { | ||
Array.from(styleSheet.cssRules || []).reduce((acc, rule) => { | ||
if (rule instanceof win.CSSImportRule) { | ||
@@ -470,4 +466,7 @@ styleSheetCache[rule.styleSheet.href] = rule.styleSheet; | ||
} else if (rule instanceof win.CSSFontFaceRule) { | ||
return acc.concat(getUrlFromCssText_1(rule.style.getPropertyValue('src'))); | ||
} else if (rule instanceof win.CSSSupportsRule || rule instanceof win.CSSMediaRule) { | ||
return acc.concat(getUrlFromCssText_1(rule.cssText)); | ||
} else if ( | ||
(win.CSSSupportsRule && rule instanceof win.CSSSupportsRule) || | ||
rule instanceof win.CSSMediaRule | ||
) { | ||
return acc.concat(extractResourcesFromStyleSheet(rule)); | ||
@@ -505,4 +504,4 @@ } else if (rule instanceof win.CSSStyleRule) { | ||
return uniq_1( | ||
[...doc.querySelectorAll('style')].reduce((resourceUrls, styleEl) => { | ||
const styleSheet = [...doc.styleSheets].find( | ||
Array.from(doc.querySelectorAll('style')).reduce((resourceUrls, styleEl) => { | ||
const styleSheet = Array.from(doc.styleSheets).find( | ||
styleSheet => styleSheet.ownerNode === styleEl, | ||
@@ -578,3 +577,7 @@ ); | ||
const styleTagUrls = flat_1(documents.map(extractResourceUrlsFromStyleTags$$1)); | ||
const links = uniq_1([...linkUrls, ...styleTagUrls, ...extractResourceUrlsFromStyleAttrs_1(cdt)]) | ||
const links = uniq_1( | ||
Array.from(linkUrls) | ||
.concat(Array.from(styleTagUrls)) | ||
.concat(extractResourceUrlsFromStyleAttrs_1(cdt)), | ||
) | ||
.map(toUnAnchoredUri_1) | ||
@@ -581,0 +584,0 @@ .map(toUriEncoding_1) |
'use strict'; | ||
function extractLinks(doc = document) { | ||
const srcsetUrls = [...doc.querySelectorAll('img[srcset],source[srcset]')] | ||
const srcsetUrls = Array.from(doc.querySelectorAll('img[srcset],source[srcset]')) | ||
.map(srcsetEl => | ||
@@ -13,23 +13,28 @@ srcsetEl | ||
const srcUrls = [...doc.querySelectorAll('img[src],source[src]')].map(srcEl => | ||
const srcUrls = Array.from(doc.querySelectorAll('img[src],source[src]')).map(srcEl => | ||
srcEl.getAttribute('src'), | ||
); | ||
const imageUrls = [...doc.querySelectorAll('image,use')] | ||
const imageUrls = Array.from(doc.querySelectorAll('image,use')) | ||
.map(hrefEl => hrefEl.getAttribute('href') || hrefEl.getAttribute('xlink:href')) | ||
.filter(u => u && u[0] !== '#'); | ||
const objectUrls = [...doc.querySelectorAll('object')] | ||
const objectUrls = Array.from(doc.querySelectorAll('object')) | ||
.map(el => el.getAttribute('data')) | ||
.filter(Boolean); | ||
const cssUrls = [...doc.querySelectorAll('link[rel="stylesheet"]')].map(link => | ||
const cssUrls = Array.from(doc.querySelectorAll('link[rel="stylesheet"]')).map(link => | ||
link.getAttribute('href'), | ||
); | ||
const videoPosterUrls = [...doc.querySelectorAll('video[poster]')].map(videoEl => | ||
const videoPosterUrls = Array.from(doc.querySelectorAll('video[poster]')).map(videoEl => | ||
videoEl.getAttribute('poster'), | ||
); | ||
return [...srcsetUrls, ...srcUrls, ...imageUrls, ...cssUrls, ...videoPosterUrls, ...objectUrls]; | ||
return Array.from(srcsetUrls) | ||
.concat(Array.from(srcUrls)) | ||
.concat(Array.from(imageUrls)) | ||
.concat(Array.from(cssUrls)) | ||
.concat(Array.from(videoPosterUrls)) | ||
.concat(Array.from(objectUrls)); | ||
} | ||
@@ -42,13 +47,5 @@ | ||
function domNodesToCdt(docNode) { | ||
const NODE_TYPES = { | ||
ELEMENT: 1, | ||
TEXT: 3, | ||
DOCUMENT: 9, | ||
DOCUMENT_TYPE: 10, | ||
DOCUMENT_FRAGMENT_NODE: 11, | ||
}; | ||
const cdt = [ | ||
{ | ||
nodeType: NODE_TYPES.DOCUMENT, | ||
nodeType: Node.DOCUMENT_NODE, | ||
}, | ||
@@ -64,3 +61,3 @@ ]; | ||
const childIndexes = []; | ||
elementNodes.forEach(elementNode => { | ||
Array.prototype.forEach.call(elementNodes, elementNode => { | ||
const index = elementNodeFactory(domNodes, documents, elementNode); | ||
@@ -78,3 +75,3 @@ if (index !== null) { | ||
const {nodeType} = elementNode; | ||
if ([NODE_TYPES.ELEMENT, NODE_TYPES.DOCUMENT_FRAGMENT_NODE].includes(nodeType)) { | ||
if ([Node.ELEMENT_NODE, Node.DOCUMENT_FRAGMENT_NODE].includes(nodeType)) { | ||
if (elementNode.nodeName !== 'SCRIPT') { | ||
@@ -87,4 +84,6 @@ if ( | ||
domNodes.push({ | ||
nodeType: NODE_TYPES.TEXT, | ||
nodeValue: [...elementNode.sheet.cssRules].map(rule => rule.cssText).join(''), | ||
nodeType: Node.TEXT_NODE, | ||
nodeValue: Array.from(elementNode.sheet.cssRules) | ||
.map(rule => rule.cssText) | ||
.join(''), | ||
}); | ||
@@ -140,3 +139,3 @@ manualChildNodeIndexes = [domNodes.length - 1]; | ||
node = { | ||
nodeType: NODE_TYPES.ELEMENT, | ||
nodeType: Node.ELEMENT_NODE, | ||
nodeName: 'SCRIPT', | ||
@@ -152,10 +151,10 @@ attributes: nodeAttributes(elementNode) | ||
} | ||
} else if (nodeType === NODE_TYPES.TEXT) { | ||
} else if (nodeType === Node.TEXT_NODE) { | ||
node = { | ||
nodeType: NODE_TYPES.TEXT, | ||
nodeType: Node.TEXT_NODE, | ||
nodeValue: elementNode.nodeValue, | ||
}; | ||
} else if (nodeType === NODE_TYPES.DOCUMENT_TYPE) { | ||
} else if (nodeType === Node.DOCUMENT_TYPE_NODE) { | ||
node = { | ||
nodeType: NODE_TYPES.DOCUMENT_TYPE, | ||
nodeType: Node.DOCUMENT_TYPE_NODE, | ||
nodeName: elementNode.nodeName, | ||
@@ -174,3 +173,3 @@ }; | ||
function nodeAttributes({attributes = {}}) { | ||
return Object.keys(attributes).filter(k => attributes[k].name); | ||
return Object.keys(attributes).filter(k => attributes[k] && attributes[k].name); | ||
} | ||
@@ -181,9 +180,2 @@ } | ||
var domNodesToCdt_1 = domNodesToCdt; | ||
var NODE_TYPES = { | ||
ELEMENT: 1, | ||
TEXT: 3, | ||
DOCUMENT: 9, | ||
DOCUMENT_TYPE: 10, | ||
}; | ||
domNodesToCdt_1.NODE_TYPES = NODE_TYPES; | ||
@@ -197,3 +189,5 @@ function flat(arr) { | ||
function extractFrames(documents = [document]) { | ||
const iframes = flat_1(documents.map(d => [...d.querySelectorAll('iframe[src]:not([src=""])')])); | ||
const iframes = flat_1( | ||
documents.map(d => Array.from(d.querySelectorAll('iframe[src]:not([src=""])'))), | ||
); | ||
return iframes | ||
@@ -326,3 +320,5 @@ .map(srcEl => { | ||
function probablyCORS(err, url) { | ||
const msgCORS = err.message && err.message.includes('Failed to fetch'); | ||
const msgCORS = | ||
err.message && | ||
(err.message.includes('Failed to fetch') || err.message.includes('Network request failed')); | ||
const nameCORS = err.name && err.name.includes('TypeError'); | ||
@@ -352,3 +348,3 @@ return msgCORS && nameCORS && !isSameOrigin(url, baseUrl); | ||
); | ||
urls = [...fromImages, ...fromObjects].filter(u => u[0] !== '#'); | ||
urls = fromImages.concat(fromObjects).filter(u => u[0] !== '#'); | ||
} catch (e) { | ||
@@ -381,3 +377,3 @@ console.log('could not parse svg content', e); | ||
return function findStyleSheetByUrl(url, documents) { | ||
const allStylesheets = flat_1(documents.map(d => [...d.styleSheets])); | ||
const allStylesheets = flat_1(documents.map(d => Array.from(d.styleSheets))); | ||
return ( | ||
@@ -408,3 +404,3 @@ styleSheetCache[url] || | ||
return uniq_1( | ||
[...(styleSheet.cssRules || [])].reduce((acc, rule) => { | ||
Array.from(styleSheet.cssRules || []).reduce((acc, rule) => { | ||
if (rule instanceof win.CSSImportRule) { | ||
@@ -414,4 +410,7 @@ styleSheetCache[rule.styleSheet.href] = rule.styleSheet; | ||
} else if (rule instanceof win.CSSFontFaceRule) { | ||
return acc.concat(getUrlFromCssText_1(rule.style.getPropertyValue('src'))); | ||
} else if (rule instanceof win.CSSSupportsRule || rule instanceof win.CSSMediaRule) { | ||
return acc.concat(getUrlFromCssText_1(rule.cssText)); | ||
} else if ( | ||
(win.CSSSupportsRule && rule instanceof win.CSSSupportsRule) || | ||
rule instanceof win.CSSMediaRule | ||
) { | ||
return acc.concat(extractResourcesFromStyleSheet(rule)); | ||
@@ -449,4 +448,4 @@ } else if (rule instanceof win.CSSStyleRule) { | ||
return uniq_1( | ||
[...doc.querySelectorAll('style')].reduce((resourceUrls, styleEl) => { | ||
const styleSheet = [...doc.styleSheets].find( | ||
Array.from(doc.querySelectorAll('style')).reduce((resourceUrls, styleEl) => { | ||
const styleSheet = Array.from(doc.styleSheets).find( | ||
styleSheet => styleSheet.ownerNode === styleEl, | ||
@@ -522,3 +521,7 @@ ); | ||
const styleTagUrls = flat_1(documents.map(extractResourceUrlsFromStyleTags$$1)); | ||
const links = uniq_1([...linkUrls, ...styleTagUrls, ...extractResourceUrlsFromStyleAttrs_1(cdt)]) | ||
const links = uniq_1( | ||
Array.from(linkUrls) | ||
.concat(Array.from(styleTagUrls)) | ||
.concat(extractResourceUrlsFromStyleAttrs_1(cdt)), | ||
) | ||
.map(toUnAnchoredUri_1) | ||
@@ -525,0 +528,0 @@ .map(toUriEncoding_1) |
@@ -10,2 +10,3 @@ 'use strict'; | ||
const getProcessPageAndPollScript = makeGetScript('processPageAndPoll'); | ||
const getProcessPageAndSerializeForIEScript = makeGetScript('processPageAndSerializeForIE'); | ||
@@ -16,2 +17,3 @@ module.exports = { | ||
getProcessPageAndPollScript, | ||
getProcessPageAndSerializeForIEScript, | ||
makeExtractResourcesFromSvg, | ||
@@ -18,0 +20,0 @@ toUriEncoding, |
{ | ||
"name": "@applitools/dom-snapshot", | ||
"version": "1.2.24", | ||
"version": "1.3.1", | ||
"main": "index.js", | ||
@@ -16,3 +16,4 @@ "license": "MIT", | ||
"build:seal:file": "sed -i \"1s/.*/\\/\\/ @applitools\\/dom-snapshot@$npm_package_version/\" $file_name", | ||
"prepublishOnly": "npm run build && npm version patch && npm run build:seal" | ||
"prepublishOnly": "npm run build && npm version patch && npm run build:seal", | ||
"surge": "surge tests/fixtures applitools-dom-snapshot.surge.sh" | ||
}, | ||
@@ -27,4 +28,8 @@ "engines": { | ||
"devDependencies": { | ||
"@applitools/monitoring-commons": "^1.0.11", | ||
"@applitools/monitoring-commons": "^1.0.15", | ||
"@babel/core": "^7.4.5", | ||
"@babel/polyfill": "^7.4.4", | ||
"@babel/preset-env": "^7.4.5", | ||
"chai": "^4.2.0", | ||
"core-js": "^3.1.4", | ||
"cors": "^2.8.5", | ||
@@ -36,18 +41,24 @@ "cssom": "git+https://github.com/amitzur/CSSOM.git#925260ff2c8f8387cf76df4d5776a06044a644c8", | ||
"eslint-plugin-prettier": "3.0.0", | ||
"express": "^4.16.4", | ||
"express": "^4.17.1", | ||
"jsdom": "^13.2.0", | ||
"mocha": "5.2.0", | ||
"node-fetch": "^2.3.0", | ||
"prettier": "^1.16.4", | ||
"node-fetch": "^2.6.0", | ||
"prettier": "^1.18.2", | ||
"puppeteer": "1.9.0", | ||
"rollup": "^0.66.6", | ||
"rollup-plugin-babel": "^4.3.3", | ||
"rollup-plugin-commonjs": "^9.3.4", | ||
"rollup-plugin-multi-entry": "^2.1.0", | ||
"rollup-plugin-node-builtins": "^2.1.2", | ||
"rollup-plugin-node-globals": "^1.4.0", | ||
"rollup-plugin-node-resolve": "^3.4.0", | ||
"rollup-plugin-polyfill": "^2.0.1", | ||
"selenium-webdriver": "^4.0.0-alpha.4", | ||
"url-polyfill": "^1.1.5", | ||
"whatwg-fetch": "^3.0.0", | ||
"xmldom": "^0.1.27" | ||
}, | ||
"dependencies": { | ||
"@applitools/functional-commons": "^1.3.7" | ||
"@applitools/functional-commons": "^1.4.1" | ||
} | ||
} |
@@ -5,13 +5,5 @@ /* eslint-disable no-use-before-define */ | ||
function domNodesToCdt(docNode) { | ||
const NODE_TYPES = { | ||
ELEMENT: 1, | ||
TEXT: 3, | ||
DOCUMENT: 9, | ||
DOCUMENT_TYPE: 10, | ||
DOCUMENT_FRAGMENT_NODE: 11, | ||
}; | ||
const cdt = [ | ||
{ | ||
nodeType: NODE_TYPES.DOCUMENT, | ||
nodeType: Node.DOCUMENT_NODE, | ||
}, | ||
@@ -27,3 +19,3 @@ ]; | ||
const childIndexes = []; | ||
elementNodes.forEach(elementNode => { | ||
Array.prototype.forEach.call(elementNodes, elementNode => { | ||
const index = elementNodeFactory(domNodes, documents, elementNode); | ||
@@ -41,3 +33,3 @@ if (index !== null) { | ||
const {nodeType} = elementNode; | ||
if ([NODE_TYPES.ELEMENT, NODE_TYPES.DOCUMENT_FRAGMENT_NODE].includes(nodeType)) { | ||
if ([Node.ELEMENT_NODE, Node.DOCUMENT_FRAGMENT_NODE].includes(nodeType)) { | ||
if (elementNode.nodeName !== 'SCRIPT') { | ||
@@ -50,4 +42,6 @@ if ( | ||
domNodes.push({ | ||
nodeType: NODE_TYPES.TEXT, | ||
nodeValue: [...elementNode.sheet.cssRules].map(rule => rule.cssText).join(''), | ||
nodeType: Node.TEXT_NODE, | ||
nodeValue: Array.from(elementNode.sheet.cssRules) | ||
.map(rule => rule.cssText) | ||
.join(''), | ||
}); | ||
@@ -103,3 +97,3 @@ manualChildNodeIndexes = [domNodes.length - 1]; | ||
node = { | ||
nodeType: NODE_TYPES.ELEMENT, | ||
nodeType: Node.ELEMENT_NODE, | ||
nodeName: 'SCRIPT', | ||
@@ -115,10 +109,10 @@ attributes: nodeAttributes(elementNode) | ||
} | ||
} else if (nodeType === NODE_TYPES.TEXT) { | ||
} else if (nodeType === Node.TEXT_NODE) { | ||
node = { | ||
nodeType: NODE_TYPES.TEXT, | ||
nodeType: Node.TEXT_NODE, | ||
nodeValue: elementNode.nodeValue, | ||
}; | ||
} else if (nodeType === NODE_TYPES.DOCUMENT_TYPE) { | ||
} else if (nodeType === Node.DOCUMENT_TYPE_NODE) { | ||
node = { | ||
nodeType: NODE_TYPES.DOCUMENT_TYPE, | ||
nodeType: Node.DOCUMENT_TYPE_NODE, | ||
nodeName: elementNode.nodeName, | ||
@@ -137,3 +131,3 @@ }; | ||
function nodeAttributes({attributes = {}}) { | ||
return Object.keys(attributes).filter(k => attributes[k].name); | ||
return Object.keys(attributes).filter(k => attributes[k] && attributes[k].name); | ||
} | ||
@@ -144,7 +138,1 @@ } | ||
module.exports = domNodesToCdt; | ||
module.exports.NODE_TYPES = { | ||
ELEMENT: 1, | ||
TEXT: 3, | ||
DOCUMENT: 9, | ||
DOCUMENT_TYPE: 10, | ||
}; |
@@ -5,3 +5,5 @@ 'use strict'; | ||
function extractFrames(documents = [document]) { | ||
const iframes = flat(documents.map(d => [...d.querySelectorAll('iframe[src]:not([src=""])')])); | ||
const iframes = flat( | ||
documents.map(d => Array.from(d.querySelectorAll('iframe[src]:not([src=""])'))), | ||
); | ||
return iframes | ||
@@ -8,0 +10,0 @@ .map(srcEl => { |
'use strict'; | ||
function extractLinks(doc = document) { | ||
const srcsetUrls = [...doc.querySelectorAll('img[srcset],source[srcset]')] | ||
const srcsetUrls = Array.from(doc.querySelectorAll('img[srcset],source[srcset]')) | ||
.map(srcsetEl => | ||
@@ -13,25 +13,30 @@ srcsetEl | ||
const srcUrls = [...doc.querySelectorAll('img[src],source[src]')].map(srcEl => | ||
const srcUrls = Array.from(doc.querySelectorAll('img[src],source[src]')).map(srcEl => | ||
srcEl.getAttribute('src'), | ||
); | ||
const imageUrls = [...doc.querySelectorAll('image,use')] | ||
const imageUrls = Array.from(doc.querySelectorAll('image,use')) | ||
.map(hrefEl => hrefEl.getAttribute('href') || hrefEl.getAttribute('xlink:href')) | ||
.filter(u => u && u[0] !== '#'); | ||
const objectUrls = [...doc.querySelectorAll('object')] | ||
const objectUrls = Array.from(doc.querySelectorAll('object')) | ||
.map(el => el.getAttribute('data')) | ||
.filter(Boolean); | ||
const cssUrls = [...doc.querySelectorAll('link[rel="stylesheet"]')].map(link => | ||
const cssUrls = Array.from(doc.querySelectorAll('link[rel="stylesheet"]')).map(link => | ||
link.getAttribute('href'), | ||
); | ||
const videoPosterUrls = [...doc.querySelectorAll('video[poster]')].map(videoEl => | ||
const videoPosterUrls = Array.from(doc.querySelectorAll('video[poster]')).map(videoEl => | ||
videoEl.getAttribute('poster'), | ||
); | ||
return [...srcsetUrls, ...srcUrls, ...imageUrls, ...cssUrls, ...videoPosterUrls, ...objectUrls]; | ||
return Array.from(srcsetUrls) | ||
.concat(Array.from(srcUrls)) | ||
.concat(Array.from(imageUrls)) | ||
.concat(Array.from(cssUrls)) | ||
.concat(Array.from(videoPosterUrls)) | ||
.concat(Array.from(objectUrls)); | ||
} | ||
module.exports = extractLinks; |
@@ -9,3 +9,3 @@ 'use strict'; | ||
return uniq( | ||
[...(styleSheet.cssRules || [])].reduce((acc, rule) => { | ||
Array.from(styleSheet.cssRules || []).reduce((acc, rule) => { | ||
if (rule instanceof win.CSSImportRule) { | ||
@@ -15,4 +15,7 @@ styleSheetCache[rule.styleSheet.href] = rule.styleSheet; | ||
} else if (rule instanceof win.CSSFontFaceRule) { | ||
return acc.concat(getUrlFromCssText(rule.style.getPropertyValue('src'))); | ||
} else if (rule instanceof win.CSSSupportsRule || rule instanceof win.CSSMediaRule) { | ||
return acc.concat(getUrlFromCssText(rule.cssText)); | ||
} else if ( | ||
(win.CSSSupportsRule && rule instanceof win.CSSSupportsRule) || | ||
rule instanceof win.CSSMediaRule | ||
) { | ||
return acc.concat(extractResourcesFromStyleSheet(rule)); | ||
@@ -19,0 +22,0 @@ } else if (rule instanceof win.CSSStyleRule) { |
@@ -7,4 +7,4 @@ 'use strict'; | ||
return uniq( | ||
[...doc.querySelectorAll('style')].reduce((resourceUrls, styleEl) => { | ||
const styleSheet = [...doc.styleSheets].find( | ||
Array.from(doc.querySelectorAll('style')).reduce((resourceUrls, styleEl) => { | ||
const styleSheet = Array.from(doc.styleSheets).find( | ||
styleSheet => styleSheet.ownerNode === styleEl, | ||
@@ -11,0 +11,0 @@ ); |
@@ -7,3 +7,3 @@ 'use strict'; | ||
return function findStyleSheetByUrl(url, documents) { | ||
const allStylesheets = flat(documents.map(d => [...d.styleSheets])); | ||
const allStylesheets = flat(documents.map(d => Array.from(d.styleSheets))); | ||
return ( | ||
@@ -10,0 +10,0 @@ styleSheetCache[url] || |
@@ -19,3 +19,3 @@ 'use strict'; | ||
); | ||
urls = [...fromImages, ...fromObjects].filter(u => u[0] !== '#'); | ||
urls = fromImages.concat(fromObjects).filter(u => u[0] !== '#'); | ||
} catch (e) { | ||
@@ -22,0 +22,0 @@ console.log('could not parse svg content', e); |
@@ -55,3 +55,7 @@ 'use strict'; | ||
const styleTagUrls = flat(documents.map(extractResourceUrlsFromStyleTags)); | ||
const links = uniq([...linkUrls, ...styleTagUrls, ...extractResourceUrlsFromStyleAttrs(cdt)]) | ||
const links = uniq( | ||
Array.from(linkUrls) | ||
.concat(Array.from(styleTagUrls)) | ||
.concat(extractResourceUrlsFromStyleAttrs(cdt)), | ||
) | ||
.map(toUnAnchoredUri) | ||
@@ -58,0 +62,0 @@ .map(toUriEncoding) |
@@ -63,3 +63,5 @@ 'use strict'; | ||
function probablyCORS(err, url) { | ||
const msgCORS = err.message && err.message.includes('Failed to fetch'); | ||
const msgCORS = | ||
err.message && | ||
(err.message.includes('Failed to fetch') || err.message.includes('Network request failed')); | ||
const nameCORS = err.name && err.name.includes('TypeError'); | ||
@@ -66,0 +68,0 @@ return msgCORS && nameCORS && !isSameOrigin(url, baseUrl); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
882996
36
19897
30
11