Skip to content

refactor(runtime): don't recreate adoptedStyleSheets#6321

Merged
christian-bromann merged 1 commit intostenciljs:mainfrom
aeharding:dont-recreate-adoptedstyles
Jun 27, 2025
Merged

refactor(runtime): don't recreate adoptedStyleSheets#6321
christian-bromann merged 1 commit intostenciljs:mainfrom
aeharding:dont-recreate-adoptedstyles

Conversation

@aeharding
Copy link
Copy Markdown
Contributor

What is the current behavior?

GitHub Issue Number: N/A

When investigating #6320 I saw that there were places that the adoptedStyleSheets array was being recreated instead of mutated. MDN docs say you should only mutate this array: https://developer.mozilla.org/en-US/docs/Web/API/Document/adoptedStyleSheets

What is the new behavior?

The array is mutated instead of recreated

Documentation

Does this introduce a breaking change?

  • Yes
  • No

I don't think this is a breaking change, since we already mutate adoptedStyleSheets here (as an example). However, I believe this was originally done because adoptedStyleSheets used to be frozen: GoogleChrome/web.dev#10294

Because there's other places in the codebase that treat adoptedStyleSheets as mutable I don't think this is breaking but I do want to highlight that.

Testing

Other information

@aeharding aeharding requested a review from a team as a code owner June 27, 2025 22:46
Copy link
Copy Markdown
Member

@christian-bromann christian-bromann left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@christian-bromann christian-bromann merged commit e35a004 into stenciljs:main Jun 27, 2025
70 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants