Socket
Socket
Sign inDemoInstall

@percy/dom

Package Overview
Dependencies
Maintainers
6
Versions
238
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@percy/dom - npm Package Compare versions

Comparing version 1.21.0 to 1.22.0-alpha.0

28

dist/bundle.js

@@ -63,3 +63,3 @@ (function() {

enableJavaScript,
disableShadowDOM
disableShadowDOMSerialization
} = _ref;

@@ -90,3 +90,3 @@ for (let frame of dom.querySelectorAll('iframe')) {

enableJavaScript,
disableShadowDOM
disableShadowDOMSerialization
});

@@ -164,3 +164,3 @@

}
function markElement(domElement, disableShadowDOM) {
function markElement(domElement, disableShadowDOMSerialization) {
var _domElement$tagName;

@@ -175,3 +175,3 @@ // Mark elements that are to be serialized later with a data attribute.

// add special marker for shadow host
if (!disableShadowDOM && domElement.shadowRoot) {
if (!disableShadowDOMSerialization && domElement.shadowRoot) {
domElement.setAttribute('data-percy-shadow-host', '');

@@ -348,3 +348,3 @@ if (!domElement.getAttribute('data-percy-element-id')) {

dom,
disableShadowDOM
disableShadowDOMSerialization
} = _ref;

@@ -361,3 +361,3 @@ // clones shadow DOM and light DOM for a given node

// mark the node before cloning
markElement(node, disableShadowDOM);
markElement(node, disableShadowDOMSerialization);
let clone = node.cloneNode();

@@ -367,3 +367,3 @@ parent.appendChild(clone);

// clone shadow DOM
if (node.shadowRoot && !disableShadowDOM) {
if (node.shadowRoot && !disableShadowDOMSerialization) {
// create shadowRoot

@@ -396,3 +396,4 @@ if (clone.shadowRoot) {

*/
function getOuterHTML(docElement) {
function getOuterHTML(ctx) {
const docElement = ctx.clone.documentElement;
// firefox doesn't serialize shadow DOM, we're awaiting API's by firefox to become ready and are not polyfilling it.

@@ -403,4 +404,5 @@ if (!docElement.getInnerHTML) {

// chromium gives us declarative shadow DOM serialization API
let innerHTML = docElement.getInnerHTML({
includeShadowRoots: true
includeShadowRoots: !ctx.disableShadowDOMSerialization
});

@@ -461,3 +463,3 @@ docElement.textContent = '';

function serializeHTML(ctx) {
let html = getOuterHTML(ctx.clone.documentElement);
let html = getOuterHTML(ctx);
// replace serialized data attributes with real attributes

@@ -499,3 +501,3 @@ html = html.replace(/ data-percy-serialized-attribute-(\w+?)=/ig, ' $1=');

stringifyResponse = options === null || options === void 0 ? void 0 : options.stringify_response,
disableShadowDOM = options === null || options === void 0 ? void 0 : options.disable_shadow_dom
disableShadowDOMSerialization = options === null || options === void 0 ? void 0 : options.disable_shadow_dom_serialization
} = options || {};

@@ -509,3 +511,3 @@

enableJavaScript,
disableShadowDOM
disableShadowDOMSerialization
};

@@ -526,3 +528,3 @@ ctx.dom = dom;

}
if (!disableShadowDOM) {
if (!disableShadowDOMSerialization) {
injectDeclarativeShadowDOMPolyfill(ctx);

@@ -529,0 +531,0 @@ }

{
"name": "@percy/dom",
"version": "1.21.0",
"version": "1.22.0-alpha.0",
"license": "MIT",

@@ -37,3 +37,3 @@ "repository": {

},
"gitHead": "44c63a3214f1fbfb0b1adcb6fcfe284a9f54d0cb"
"gitHead": "5928e586c401ac10840d1ec6219875526e45d100"
}

@@ -40,3 +40,3 @@ # @percy/dom

- `domTransformation` — Function to transform the DOM after serialization
- `disableShadowDOM` — disable shadow DOM capturing, this option can be passed to `percySnapshot` its part of per-snapshot config.
- `disableShadowDOMSerialization` — disable shadow DOM capturing, this option can be passed to `percySnapshot` its part of per-snapshot config.

@@ -43,0 +43,0 @@ ## Serialized Content

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