Skip to main content

Function: isBlock()

isBlock(node, _options): boolean

Defined in: packages/core/src/dom/index.ts:278

Tests a node by tagName and/or className

This function expects to be used with DOMNode objects from html-react-parser, which is the underlying parser used by BlocksRenderer.

Usage

import { isBlock } from '@headstartwp/core';

<BlocksRenderer html={html}>
<MyCustomBlock
test={(node) => isBlock(node, { tagName: 'div', classList: ['block-class-name'] })}
/>
</BlocksRenderer>

Parameters

node

DOMNode

The node to test

_options

isBlockOptions

Returns

boolean

true if the node passes the test