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

@percy/dom

Package Overview
Dependencies
Maintainers
1
Versions
261
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.31.0-alpha.2 to 1.31.0-alpha.3

29

dist/bundle.js

@@ -550,11 +550,5 @@ (function() {

*/
function getOuterHTML(docElement) {
// All major browsers in latest versions supports getHTML API to get serialized DOM
// https://developer.mozilla.org/en-US/docs/Web/API/Element/getHTML
// old firefox doesn't serialize shadow DOM, we're awaiting API's by firefox to become ready and are not polyfilling it.
// new firefox from 128 onwards serializes it using getHTML
/* istanbul ignore if: Only triggered in firefox <= 128 and tests runs on latest */
if (!docElement.getHTML) {
return docElement.outerHTML;
}
function getOuterHTML(docElement, {
shadowRootElements
}) {
// chromium gives us declarative shadow DOM serialization API

@@ -564,4 +558,7 @@ let innerHTML = '';

if (docElement.getHTML) {
// All major browsers in latest versions supports getHTML API to get serialized DOM
// https://developer.mozilla.org/en-US/docs/Web/API/Element/getHTML
innerHTML = docElement.getHTML({
serializableShadowRoots: true
serializableShadowRoots: true,
shadowRoots: shadowRootElements
});

@@ -572,2 +569,6 @@ } else if (docElement.getInnerHTML) {

});
} else {
// old firefox doesn't serialize shadow DOM, we're awaiting API's by firefox to become ready and are not polyfilling it.
// new firefox from 128 onwards serializes it using getHTML
return docElement.outerHTML;
}

@@ -600,3 +601,5 @@ docElement.textContent = '';

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

@@ -619,2 +622,5 @@ html = html.replace(/ data-percy-serialized-attribute-(\w+?)=/ig, ' $1=');

if (shadowHost.shadowRoot && cloneShadowHost.shadowRoot) {
// getHTML requires shadowRoot to be passed explicitly
// to serialize the shadow elements properly
ctx.shadowRootElements.push(cloneShadowHost.shadowRoot);
serializeElements({

@@ -665,2 +671,3 @@ ...ctx,

cache: new Map(),
shadowRootElements: [],
enableJavaScript,

@@ -667,0 +674,0 @@ disableShadowDOM

{
"name": "@percy/dom",
"version": "1.31.0-alpha.2",
"version": "1.31.0-alpha.3",
"license": "MIT",

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

},
"gitHead": "1c7711f564fd4a112e1e1490a772db757df0535d"
"gitHead": "14ae0b4319c1c2ae28729d56cba3b159e80386a8"
}
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