Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@applitools/dom-capture

Package Overview
Dependencies
Maintainers
19
Versions
96
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@applitools/dom-capture - npm Package Compare versions

Comparing version 7.1.1 to 7.1.2

src/browser/isDataUrl.js

44

dist/captureDom.js

@@ -1,2 +0,2 @@

/* @applitools/dom-capture@7.1.1 */
/* @applitools/dom-capture@7.1.2 */

@@ -117,3 +117,3 @@ function __captureDom() {

}) {
return function getBundledCssFromCssText(cssText, resourceUrl) {
return function getBundledCssFromCssText(cssText, styleBaseUrl) {
let unfetchedResources;

@@ -126,3 +126,3 @@ let bundledCss = '';

if (rule instanceof CSSImportRule) {
const nestedUrl = absolutizeUrl(rule.href, resourceUrl);
const nestedUrl = absolutizeUrl(rule.href, styleBaseUrl);
const nestedResource = getCssFromCache(nestedUrl);

@@ -144,6 +144,6 @@ if (nestedResource !== undefined) {

} catch (ex) {
console.log(`error during getBundledCssFromCssText, resourceUrl=${resourceUrl}`, ex);
console.log(`error during getBundledCssFromCssText, styleBaseUrl=${styleBaseUrl}`, ex);
}
bundledCss = `${bundledCss}${getCss(cssText, resourceUrl)}`;
bundledCss = `${bundledCss}${getCss(cssText, styleBaseUrl)}`;

@@ -207,5 +207,11 @@ return {

function isDataUrl(url) {
return url && url.startsWith('data:');
}
var isDataUrl_1 = isDataUrl;
function makeExtractCssFromNode({getCssFromCache, absolutizeUrl}) {
return function extractCssFromNode(node, baseUrl) {
let cssText, resourceUrl, isUnfetched;
let cssText, styleBaseUrl, isUnfetched;
if (isStyleElement(node)) {

@@ -215,11 +221,15 @@ cssText = Array.from(node.childNodes)

.join('');
resourceUrl = baseUrl;
styleBaseUrl = baseUrl;
} else if (isLinkToStyleSheet(node)) {
resourceUrl = absolutizeUrl(getHrefAttr(node), baseUrl);
cssText = getCssFromCache(resourceUrl);
if (cssText === undefined) {
isUnfetched = true;
const href = getHrefAttr(node);
if (!isDataUrl_1(href)) {
styleBaseUrl = absolutizeUrl(href, baseUrl);
cssText = getCssFromCache(styleBaseUrl);
} else {
styleBaseUrl = baseUrl;
cssText = href.match(/,(.+)/)[1];
}
isUnfetched = cssText === undefined;
}
return {cssText, resourceUrl, isUnfetched};
return {cssText, styleBaseUrl, isUnfetched};
};

@@ -236,3 +246,3 @@ }

return function captureNodeCss(node, baseUrl) {
const {resourceUrl, cssText, isUnfetched} = extractCssFromNode(node, baseUrl);
const {styleBaseUrl, cssText, isUnfetched} = extractCssFromNode(node, baseUrl);

@@ -244,3 +254,3 @@ let unfetchedResources;

cssText,
resourceUrl,
styleBaseUrl,
);

@@ -251,4 +261,4 @@

} else if (isUnfetched) {
bundledCss += `${unfetchedToken}${resourceUrl}${unfetchedToken}`;
unfetchedResources = new Set([resourceUrl]);
bundledCss += `${unfetchedToken}${styleBaseUrl}${unfetchedToken}`;
unfetchedResources = new Set([styleBaseUrl]);
}

@@ -415,3 +425,3 @@ return {bundledCss, unfetchedResources};

capturedFrame.version = API_VERSION;
capturedFrame.scriptVersion = '7.1.0';
capturedFrame.scriptVersion = '7.1.1';

@@ -418,0 +428,0 @@ const iframePrefix = iframeCors.length ? `${iframeCors.join('\n')}\n` : '';

@@ -1,2 +0,2 @@

/* @applitools/dom-capture@7.1.1 */
/* @applitools/dom-capture@7.1.2 */

@@ -117,3 +117,3 @@ function __captureDomAndPoll() {

}) {
return function getBundledCssFromCssText(cssText, resourceUrl) {
return function getBundledCssFromCssText(cssText, styleBaseUrl) {
let unfetchedResources;

@@ -126,3 +126,3 @@ let bundledCss = '';

if (rule instanceof CSSImportRule) {
const nestedUrl = absolutizeUrl(rule.href, resourceUrl);
const nestedUrl = absolutizeUrl(rule.href, styleBaseUrl);
const nestedResource = getCssFromCache(nestedUrl);

@@ -144,6 +144,6 @@ if (nestedResource !== undefined) {

} catch (ex) {
console.log(`error during getBundledCssFromCssText, resourceUrl=${resourceUrl}`, ex);
console.log(`error during getBundledCssFromCssText, styleBaseUrl=${styleBaseUrl}`, ex);
}
bundledCss = `${bundledCss}${getCss(cssText, resourceUrl)}`;
bundledCss = `${bundledCss}${getCss(cssText, styleBaseUrl)}`;

@@ -207,5 +207,11 @@ return {

function isDataUrl(url) {
return url && url.startsWith('data:');
}
var isDataUrl_1 = isDataUrl;
function makeExtractCssFromNode({getCssFromCache, absolutizeUrl}) {
return function extractCssFromNode(node, baseUrl) {
let cssText, resourceUrl, isUnfetched;
let cssText, styleBaseUrl, isUnfetched;
if (isStyleElement(node)) {

@@ -215,11 +221,15 @@ cssText = Array.from(node.childNodes)

.join('');
resourceUrl = baseUrl;
styleBaseUrl = baseUrl;
} else if (isLinkToStyleSheet(node)) {
resourceUrl = absolutizeUrl(getHrefAttr(node), baseUrl);
cssText = getCssFromCache(resourceUrl);
if (cssText === undefined) {
isUnfetched = true;
const href = getHrefAttr(node);
if (!isDataUrl_1(href)) {
styleBaseUrl = absolutizeUrl(href, baseUrl);
cssText = getCssFromCache(styleBaseUrl);
} else {
styleBaseUrl = baseUrl;
cssText = href.match(/,(.+)/)[1];
}
isUnfetched = cssText === undefined;
}
return {cssText, resourceUrl, isUnfetched};
return {cssText, styleBaseUrl, isUnfetched};
};

@@ -236,3 +246,3 @@ }

return function captureNodeCss(node, baseUrl) {
const {resourceUrl, cssText, isUnfetched} = extractCssFromNode(node, baseUrl);
const {styleBaseUrl, cssText, isUnfetched} = extractCssFromNode(node, baseUrl);

@@ -244,3 +254,3 @@ let unfetchedResources;

cssText,
resourceUrl,
styleBaseUrl,
);

@@ -251,4 +261,4 @@

} else if (isUnfetched) {
bundledCss += `${unfetchedToken}${resourceUrl}${unfetchedToken}`;
unfetchedResources = new Set([resourceUrl]);
bundledCss += `${unfetchedToken}${styleBaseUrl}${unfetchedToken}`;
unfetchedResources = new Set([styleBaseUrl]);
}

@@ -415,3 +425,3 @@ return {bundledCss, unfetchedResources};

capturedFrame.version = API_VERSION;
capturedFrame.scriptVersion = '7.1.0';
capturedFrame.scriptVersion = '7.1.1';

@@ -418,0 +428,0 @@ const iframePrefix = iframeCors.length ? `${iframeCors.join('\n')}\n` : '';

@@ -1,2 +0,2 @@

/* @applitools/dom-capture@7.1.1 */
/* @applitools/dom-capture@7.1.2 */
'use strict';

@@ -114,3 +114,3 @@

}) {
return function getBundledCssFromCssText(cssText, resourceUrl) {
return function getBundledCssFromCssText(cssText, styleBaseUrl) {
let unfetchedResources;

@@ -123,3 +123,3 @@ let bundledCss = '';

if (rule instanceof CSSImportRule) {
const nestedUrl = absolutizeUrl(rule.href, resourceUrl);
const nestedUrl = absolutizeUrl(rule.href, styleBaseUrl);
const nestedResource = getCssFromCache(nestedUrl);

@@ -141,6 +141,6 @@ if (nestedResource !== undefined) {

} catch (ex) {
console.log(`error during getBundledCssFromCssText, resourceUrl=${resourceUrl}`, ex);
console.log(`error during getBundledCssFromCssText, styleBaseUrl=${styleBaseUrl}`, ex);
}
bundledCss = `${bundledCss}${getCss(cssText, resourceUrl)}`;
bundledCss = `${bundledCss}${getCss(cssText, styleBaseUrl)}`;

@@ -204,5 +204,11 @@ return {

function isDataUrl(url) {
return url && url.startsWith('data:');
}
var isDataUrl_1 = isDataUrl;
function makeExtractCssFromNode({getCssFromCache, absolutizeUrl}) {
return function extractCssFromNode(node, baseUrl) {
let cssText, resourceUrl, isUnfetched;
let cssText, styleBaseUrl, isUnfetched;
if (isStyleElement(node)) {

@@ -212,11 +218,15 @@ cssText = Array.from(node.childNodes)

.join('');
resourceUrl = baseUrl;
styleBaseUrl = baseUrl;
} else if (isLinkToStyleSheet(node)) {
resourceUrl = absolutizeUrl(getHrefAttr(node), baseUrl);
cssText = getCssFromCache(resourceUrl);
if (cssText === undefined) {
isUnfetched = true;
const href = getHrefAttr(node);
if (!isDataUrl_1(href)) {
styleBaseUrl = absolutizeUrl(href, baseUrl);
cssText = getCssFromCache(styleBaseUrl);
} else {
styleBaseUrl = baseUrl;
cssText = href.match(/,(.+)/)[1];
}
isUnfetched = cssText === undefined;
}
return {cssText, resourceUrl, isUnfetched};
return {cssText, styleBaseUrl, isUnfetched};
};

@@ -233,3 +243,3 @@ }

return function captureNodeCss(node, baseUrl) {
const {resourceUrl, cssText, isUnfetched} = extractCssFromNode(node, baseUrl);
const {styleBaseUrl, cssText, isUnfetched} = extractCssFromNode(node, baseUrl);

@@ -241,3 +251,3 @@ let unfetchedResources;

cssText,
resourceUrl,
styleBaseUrl,
);

@@ -248,4 +258,4 @@

} else if (isUnfetched) {
bundledCss += `${unfetchedToken}${resourceUrl}${unfetchedToken}`;
unfetchedResources = new Set([resourceUrl]);
bundledCss += `${unfetchedToken}${styleBaseUrl}${unfetchedToken}`;
unfetchedResources = new Set([styleBaseUrl]);
}

@@ -412,3 +422,3 @@ return {bundledCss, unfetchedResources};

capturedFrame.version = API_VERSION;
capturedFrame.scriptVersion = '7.1.0';
capturedFrame.scriptVersion = '7.1.1';

@@ -415,0 +425,0 @@ const iframePrefix = iframeCors.length ? `${iframeCors.join('\n')}\n` : '';

{
"name": "@applitools/dom-capture",
"version": "7.1.1",
"version": "7.1.2",
"main": "index.js",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -22,3 +22,3 @@ {

"semi": true,
"parser": "babylon",
"parser": "babel",
"printWidth": 100,

@@ -25,0 +25,0 @@ "singleQuote": true,

@@ -5,3 +5,3 @@ 'use strict';

return function captureNodeCss(node, baseUrl) {
const {resourceUrl, cssText, isUnfetched} = extractCssFromNode(node, baseUrl);
const {styleBaseUrl, cssText, isUnfetched} = extractCssFromNode(node, baseUrl);

@@ -13,3 +13,3 @@ let unfetchedResources;

cssText,
resourceUrl,
styleBaseUrl,
);

@@ -20,4 +20,4 @@

} else if (isUnfetched) {
bundledCss += `${unfetchedToken}${resourceUrl}${unfetchedToken}`;
unfetchedResources = new Set([resourceUrl]);
bundledCss += `${unfetchedToken}${styleBaseUrl}${unfetchedToken}`;
unfetchedResources = new Set([styleBaseUrl]);
}

@@ -24,0 +24,0 @@ return {bundledCss, unfetchedResources};

@@ -5,6 +5,7 @@ 'use strict';

const isLinkToStyleSheet = require('./isLinkToStyleSheet');
const isDataUrl = require('./isDataUrl');
function makeExtractCssFromNode({getCssFromCache, absolutizeUrl}) {
return function extractCssFromNode(node, baseUrl) {
let cssText, resourceUrl, isUnfetched;
let cssText, styleBaseUrl, isUnfetched;
if (isStyleElement(node)) {

@@ -14,11 +15,15 @@ cssText = Array.from(node.childNodes)

.join('');
resourceUrl = baseUrl;
styleBaseUrl = baseUrl;
} else if (isLinkToStyleSheet(node)) {
resourceUrl = absolutizeUrl(getHrefAttr(node), baseUrl);
cssText = getCssFromCache(resourceUrl);
if (cssText === undefined) {
isUnfetched = true;
const href = getHrefAttr(node);
if (!isDataUrl(href)) {
styleBaseUrl = absolutizeUrl(href, baseUrl);
cssText = getCssFromCache(styleBaseUrl);
} else {
styleBaseUrl = baseUrl;
cssText = href.match(/,(.+)/)[1];
}
isUnfetched = cssText === undefined;
}
return {cssText, resourceUrl, isUnfetched};
return {cssText, styleBaseUrl, isUnfetched};
};

@@ -25,0 +30,0 @@ }

@@ -10,3 +10,3 @@ 'use strict';

}) {
return function getBundledCssFromCssText(cssText, resourceUrl) {
return function getBundledCssFromCssText(cssText, styleBaseUrl) {
let unfetchedResources;

@@ -19,3 +19,3 @@ let bundledCss = '';

if (rule instanceof CSSImportRule) {
const nestedUrl = absolutizeUrl(rule.href, resourceUrl);
const nestedUrl = absolutizeUrl(rule.href, styleBaseUrl);
const nestedResource = getCssFromCache(nestedUrl);

@@ -37,6 +37,6 @@ if (nestedResource !== undefined) {

} catch (ex) {
console.log(`error during getBundledCssFromCssText, resourceUrl=${resourceUrl}`, ex);
console.log(`error during getBundledCssFromCssText, styleBaseUrl=${styleBaseUrl}`, ex);
}
bundledCss = `${bundledCss}${getCss(cssText, resourceUrl)}`;
bundledCss = `${bundledCss}${getCss(cssText, styleBaseUrl)}`;

@@ -43,0 +43,0 @@ return {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc