Skip to content

fix(dom-to-react): transform style to object for Web Components#193

Merged
remarkablemark merged 1 commit intomasterfrom
fix/web-components-style
Dec 12, 2020
Merged

fix(dom-to-react): transform style to object for Web Components#193
remarkablemark merged 1 commit intomasterfrom
fix/web-components-style

Conversation

@remarkablemark
Copy link
Copy Markdown
Owner

What is the motivation for this pull request?

fix(dom-to-react): transform style to object for Web Components

Fixes #188

What is the current behavior?

Web Components skip the attributesToProps process. However, React still expects the custom element style prop to be an object and not a string:

Error: The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + 'em'}} when using JSX.

What is the new behavior?

Web Components will only get the style attribute transformed into an object.

Checklist:

  • Tests

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 100.0% when pulling 83efbce on fix/web-components-style into 2afcf15 on master.

@remarkablemark remarkablemark merged commit 8dbfc13 into master Dec 12, 2020
@remarkablemark remarkablemark deleted the fix/web-components-style branch December 12, 2020 06:26
@remarkablemark
Copy link
Copy Markdown
Owner Author

Published 0.14.3:

npm:

npm i html-react-parser@0.14.3

Yarn:

yarn add html-react-parser@0.14.3

@calvinswinnen
Copy link
Copy Markdown

This is still an issue at 1.2.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Doesn't work with web components with style attributes

4 participants