We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
domNode instanceof Element
false
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
domNode instanceof Element should be true
true
domNode instanceof Element is always false
const WordpressContent = ({ html }: IWordpressContentProps): JSX.Element => { const options: HTMLReactParserOptions = { replace: (domNode: DOMNode) => { console.log({ domNode, element: domNode instanceof Element }) if ( domNode instanceof Element && domNode.attribs && domNode.attribs.class === "wp-block-page-header" ) { return <div className="border-8 border-red-500">{domToReact(domNode.children, options)}</div> } } } return <div className="border-8 border-purple-500">{parse(html, options)}</div> }
Results in logs like below and nothing is replaced
domNode: Element {type: 'tag', parent: null, prev: null, next: null, startIndex: null, …} element: false
The text was updated successfully, but these errors were encountered:
using a typeguard worked for me #221 (comment)
Sorry, something went wrong.
No branches or pull requests
Uh oh!
There was an error while loading. Please reload this page.
Expected Behavior
domNode instanceof Element
should betrue
Actual Behavior
domNode instanceof Element
is alwaysfalse
Steps to Reproduce
Results in logs like below and nothing is replaced
Environment
The text was updated successfully, but these errors were encountered: