HTML Serializer is Incompatible with React-Native
See original GitHub issueDo you want to request a feature or report a bug?
Feature
What’s the current behavior?
Trying to import the html-serializer
into a react-native
project causes the error:
document is not defined
- I assume this occurs because the html-serializer
relies on the built in DOMParser
The above is inaccurate and seems to be caused by my schema
somehow, although I believe the issue itself is still relevant as React-Native is missing DOMParser as far as I can tell.
What’s the expected behavior?
It’s probably not reasonable to expect this to work out of the box, but it would be great to:
- Find a way to throw a friendlier error message thrown before React-Native can throw its own - Right now we have that, but React-Native beats it to the punch.
- Determine an alternative to
DOMParser
andjsdom
that can be passed to thehtml-serializer
Potentially interesting avenues to explore:
- https://www.npmjs.com/package/react-native-dom-parser
- Find a way to use
jsdom
without reliance on NodeJS built-ins
@ianstormtaylor do you have any ideas that might be less cumbersome than the above?
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
How to fix the incompatible version problems in a React app?
I have a React application and I use Yarn to maintain packages. ... field "ansi-html@0.0.8" is incompatible with requested version ...
Read more >react-native-parse-html - npm
Start using react-native-parse-html in your project by running `npm ... ready for production HTML parsing/serialization toolset for Node.js.
Read more >react-native | Yarn - Package Manager
React Native brings React's declarative UI framework to iOS and Android. With React Native, you use native UI controls and have full access...
Read more >Configuration cache - Gradle User Manual
Gradle uses its own optimized serialization mechanism and format to store the configuration cache entries. It automatically serializes the state of ...
Read more >Node.js v19.3.0 Documentation
html document has a corresponding .json document. This is for IDEs and other utilities that consume the documentation. System calls and man pages#....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I had an issue with
parse5
wherenode.nodeValue
is null in parse5, butnode.value
isn’t:https://github.com/ianstormtaylor/slate/blob/master/packages/slate-html-serializer/src/index.js#L47
I haven’t looked into what is right.
As of https://github.com/ianstormtaylor/slate/pull/3093 (which was just merged), I believe this issue is no longer applicable, because a lot has changed. I’m going through and closing out any potential issues that are not out of date with the overhaul. Thanks for understanding.