-
-
Notifications
You must be signed in to change notification settings - Fork 129
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
Doesn't work with web components with custom attributes #77
Comments
@bschlenk Yes, that behavior is intended. It ensures the attribute is translated to an attribute supported by React. Could the replace option be used in your case? |
React supports all attributes, that’s how it’s able to support custom elements. It will gladly pass along any prop you give it if the html tag isn’t recognized. I’m not sure about the exact behavior, it might require that the tag is a valid custom element (it has at least one hyphen and all lower case). I can create a code pen demonstrating this if you want. |
Here’s the issue where they talk about supporting any attribute for custom elements: facebook/react#2746 It looks like it’s been supported since Here’s a better link to their blog post about it: https://reactjs.org/blog/2017/09/08/dom-attributes-in-react-16.html |
I didn't realize React made the change in 16+, thanks for sharing the link @bschlenk I'm open to making a backwards compatible change to allow for this |
To make it backwards compatible it would probably have to check what version of react is installed. I'm not sure on the exact logic, but here's what I'm thinking:
I made these changes on my machine, I can send you a pull request once I get tests written. |
seems doesn't work if web components have style attributes.
|
@sinchang Can you help me provide a reproducible example with CodeSandbox, JSFiddle, or Repl.it? If we can confirm this is a bug, let's create a new issue. |
@remarkablemark I created a demo on https://codesandbox.io/s/html-react-parser-forked-vll1t?file=/src/index.js:281322-281329, please have a look. |
@sinchang Can you open a new issue and update your demo so <share-widget-desktop style="display: none; position: absolute;"></share-widget-desktop> Since that's enough to reproduce the bug? |
If I pass in an html string with attributes this doesn't recognize, they are not included in the props.
This will only include
label
, but notmy-custom-prop
.The text was updated successfully, but these errors were encountered: