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
253
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@percy/dom

Serializes a document's DOM into a DOM string suitable for re-rendering.

  • 1.30.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
333K
decreased by-9.54%
Maintainers
1
Weekly downloads
 
Created

What is @percy/dom?

@percy/dom is an npm package designed to facilitate visual testing by capturing and serializing the DOM (Document Object Model) of web pages. This allows for visual comparisons to be made between different states of a web page, ensuring that changes do not introduce visual regressions.

What are @percy/dom's main functionalities?

Serialize DOM

This feature allows you to serialize the current state of the DOM into a string. This serialized DOM can then be used for visual comparisons.

const percyDOM = require('@percy/dom');
const domSnapshot = percyDOM.serialize();
console.log(domSnapshot);

Capture Specific Elements

This feature allows you to capture and serialize only specific elements within the DOM by specifying a CSS selector. This is useful for focusing on particular parts of a web page.

const percyDOM = require('@percy/dom');
const domSnapshot = percyDOM.serialize({ scope: '#main-content' });
console.log(domSnapshot);

Exclude Elements

This feature allows you to exclude certain elements from the DOM snapshot by specifying CSS selectors. This is useful for ignoring dynamic or irrelevant parts of a web page.

const percyDOM = require('@percy/dom');
const domSnapshot = percyDOM.serialize({ ignore: ['.ad-banner', '.tracking-pixel'] });
console.log(domSnapshot);

Other packages similar to @percy/dom

FAQs

Package last updated on 02 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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