testing-library / testing-library/dom-testing-library

prettyDOM should be able to serialize shadowRoots

Open
#1,188 5 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
JavaScript
Stars
3.3k
Forks
474
PR merge metrics
No merged PRs in 30d

Description

Splitting this out from #484

A ShadowRoot is a DocumentFragment node that should be able to be serialized by pretty-format & prettyDOM,

A few changes would be needed in pretty-dom, including removing or altering the check for outerHTML (shadowRoot has innerHTML only) and adding recursive traversal of the node.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/pretty-dom.js by reading the existing outerHTML check and how nodes are traversed. Use the linked ShadowRoot and Node nodeType references to understand the relevant DOM behavior. Done means prettyDOM can serialize ShadowRoot content through recursive traversal without relying on outerHTML.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
testing-qa
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.