Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix[ISSUE_1819]: Support for serialising ShadowRoot Element for Chrome 131 onwards #1820

Merged
merged 2 commits into from
Dec 11, 2024

Conversation

this-is-shivamsingh
Copy link
Contributor

@this-is-shivamsingh this-is-shivamsingh commented Dec 11, 2024

Changes:

  1. From chrome 131 onward, there is a restriction on serialising shadowroot elements
  2. To serialise the the shadow element perfectly, we need to explicitly pass the shadowRoot elements with getHTML
    Refer here: https://developer.mozilla.org/en-US/docs/Web/API/Element/getHTML#shadowroots

Testing:

  1. Tested with CLI flow ( that contains Chrome 123 )
  2. Tested with firefox as test browser from versions in between (126 - 132)
  3. Tested with Chrome 131 ( latest )

// 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; }
Copy link
Contributor Author

@this-is-shivamsingh this-is-shivamsingh Dec 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Need to remove this, as this was blocking snapshot CLI flow, as our discovery is Chrome 123, and getHTML is only supported from Chrome 125 onwards
  • It's handled in else block now

@this-is-shivamsingh this-is-shivamsingh changed the title Fix: Support for serialising ShadowRoot Element for Chrome 131 onwards Fix[ISSUE_1819]: Support for serialising ShadowRoot Element for Chrome 131 onwards Dec 11, 2024
Copy link
Contributor

@pankaj443 pankaj443 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎸

@this-is-shivamsingh this-is-shivamsingh merged commit 8d278a2 into master Dec 11, 2024
36 checks passed
@this-is-shivamsingh this-is-shivamsingh deleted the PPLT_3584 branch December 11, 2024 13:52
@this-is-shivamsingh this-is-shivamsingh added ✨ enhancement New feature or request 💥 breaking Breaking change labels Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💥 breaking Breaking change ✨ enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants