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

feat: implement DSD polyfill as an optional plugin for FAST SSR #6289

Merged
merged 6 commits into from
Aug 18, 2022

Conversation

EisenbergEffect
Copy link
Contributor

@EisenbergEffect EisenbergEffect commented Aug 17, 2022

Pull Request

📖 Description

This PR embeds the necessary CSS and JavaScript polyfill code to ensure that Declarative Shadow DOM (DSD) is properly handled on browsers that don't yet implement the standard.

The SSR example has been updated to emit the polyfill code into the page.

🎫 Issues

👩‍💻 Reviewer Notes

The polyfill code is generally available on the web. This PR simply embeds it in our SSR package for convenience.

See the SSR example server.js file for usage.

📑 Test Plan

No tests added for this as this just provides a convenience API over a well-known polyfill.

✅ Checklist

General

  • I have included a change request file using $ yarn change
  • I have added tests for my changes.
  • I have tested my changes.
  • I have updated the project documentation to reflect my changes.
  • I have read the CONTRIBUTING documentation and followed the standards for this project.

⏭ Next Steps

An alternative polyfill method that supports streaming could be added. For this, we would embed a small global script in the page head and then emit a script tag immediately following each DSD instance, which called that global function, passing in the currentScript. This has some perf implications, since it would block the parser after every DSD instance. It also would require deeper integration into our renderer in order to emit the script tag after the close of the DSD template tag.

Due to the downsides and increased complexity of this approach, I'm not pursuing implementing this for now. We can revisit this if there is a specific request for it. Additionally, it will likely be easier to implement into the renderer after the shared styles feature is complete, since both will need renderer configuration that is passed through the tree and both need to custom render content per component.

@EisenbergEffect EisenbergEffect merged commit e8fa95d into master Aug 18, 2022
@EisenbergEffect EisenbergEffect deleted the users/eisenbergeffect/dsd-polyfill branch August 18, 2022 18:49
janechu pushed a commit that referenced this pull request Jun 10, 2024
* feat: implement DSD polyfill for SSR

* Change files

* chore: fix change file

* fix: change polyfill property types to prevent API extractor embed

* chore: fix prettier error in dsd polyfill code

Co-authored-by: EisenbergEffect <roeisenb@microsoft.com>
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.

feat: declarative shadow DOM polyfill
4 participants