preact-render-to-string
preact-render-to-string copied to clipboard
Transform attribute names to proper casing
Makes sure attributes are converted to their proper casing when rendering to string. There was a similar attempt with #55 but it was never completed. Reviving it particularly because Safari is excessively downloading an img's src upon hydration due to srcSet
casing mismatch between preact/preact-render-to-string. This also adds better support for attributes specific to SVG/RSS/XML.
Incorporated the concerns from the comments in the other attempts/issues.
Attribute list reference: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes React reference: https://github.com/facebook/react/blob/main/packages/react-dom/src/shared/possibleStandardNames.js
Closes #55 Closes #18
@gpoitch I think it's definitely something we should address. Regarding the closing: Did you ran into problems with this PR? I'm mainly curious to see if there is a way without changing the casing in the JSX renderer, but lowercase it in the default mode.
@marvinhagemeister accidental auto-close referencing this PR in a private repo. Not familiar with default vs jsx mode - I'll have to read the source code more and circle back.
@marvinhagemeister I updated it so the jsx renderer is unaffected by applying the normalization after the attribute hook intercepts the standard rendering.
🦋 Changeset detected
Latest commit: 61cd8c28f1bd014c5f8dd7cae0167793dd62c166
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 1 package
Name | Type |
---|---|
preact-render-to-string | Patch |
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR