Skip to main content

Function: isAnchorTag()

isAnchorTag(node, options, site): node is Element

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

Checks if the provided node is an valid anchor tag

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

Usage

import { isAnchorTag } from '@headstartwp/core';
import { LinkBlock } from '@10up/headless-next';

<BlocksRenderer html={html}>
<LinkBlock test={(node) => isAnchorTag(node, { isInternalLink: true})} />
</BlocksRenderer>

Parameters

node

DOMNode

The node to test

options

isAnchorTagOptions = {}

Supported options

site

undefined | HeadlessConfig

Returns

node is Element

Whether it's an anchor tag according to the options passed