hast utility to check if an element is labelable.
npm:
npm install hast-util-labelable
var labelable = require('hast-util-labelable')
labelable({type: 'element', tagName: 'div'}) // => false
labelable({type: 'element', tagName: 'input'}) // => true
labelable({
type: 'element',
tagName: 'input',
properties: {type: 'hidden'}
}) // => false
Check if the given value is a labelable element.
node
(*
, optional) — Value to check, probablyNode
boolean
— Whether node
is a labelable element.
Labelable nodes have a tagName
set to button
, keygen
,
meter
, output
, progress
, select
, textarea
, and input
(excluding [type=hidden]
).
hast-util-labelable
does not change the syntax tree so there are no openings
for cross-site scripting (XSS) attacks.
See contributing.md
in syntax-tree/.github
for ways to get
started.
See support.md
for ways to get help.
This project has a Code of Conduct. By interacting with this repository, organisation, or community you agree to abide by its terms.