Bug: when used with jsdom-jscore-rn, importing react-dom crashes #25920
Labels
Component: DOM
Resolution: Stale
Automatically closed due to inactivity
Status: Unconfirmed
A potential issue that we haven't yet confirmed as a bug
React version: 18.2.0
Steps To Reproduce
Install the
jsdom-jscore-rn
andreact-dom
packages locally and then run this Node.js script:Importing the
react-dom
package will crash:What happened? There is the
jsdom-jscore-rn
package that provides a very bare-bones implementation of DOM (likejsdom
but much smaller), intended for React Native apps that need to have some DOM available. Typically to please libraries that depend on it, like thehpq
HTML parser lib. The mobile version of the Gutenberg editor usesjsdom-jscore-rn
.The
jsdom-jscore-rn
DOM doesn't support the.style
attribute on elements. Accessing anel.style
returnsundefined
, not an instance ofCSSStyleDeclaration
. But this confusesreact-dom
'sgetVendorPrefixedEventName
code that will assign theundefined
value to the globalstyle
variable and will try to access its properties with statements likestyleProp in style
.It would be nice if
react-dom
could do one additional check on theel.style
attribute before assigning it to the globalstyle
. It would make the package more compatible with--admittedly very strange, but realistic--environments that combine React Native,jsdom-jscore-rn
andreact-dom
. Note that we don't even have to use anything fromreact-dom
to trigger the bug, we're merely importing it. Maybe in some test environment where there's nothing like tree shaking that would remove unused modules.The text was updated successfully, but these errors were encountered: