Have ideas to improve npm?Join in the discussion! »

    hast-util-labelable

    1.0.4 • Public • Published

    hast-util-labelable

    Build Coverage Downloads Size Sponsors Backers Chat

    hast utility to check if an element is labelable.

    Install

    npm:

    npm install hast-util-labelable

    Use

    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

    API

    labelable(node)

    Check if the given value is a labelable element.

    Parameters
    • node (*, optional) — Value to check, probably Node
    Returns

    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]).

    Security

    hast-util-labelable does not change the syntax tree so there are no openings for cross-site scripting (XSS) attacks.

    Contribute

    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, organization, or community you agree to abide by its terms.

    License

    MIT © Titus Wormer

    Install

    npm i hast-util-labelable

    DownloadsWeekly Downloads

    7

    Version

    1.0.4

    License

    MIT

    Unpacked Size

    6.72 kB

    Total Files

    4

    Last publish

    Collaborators

    • avatar
    • avatar