unified

Project:syntax-tree/hast-util-interactive

Package:hast-util-interactive@1.0.5

  1. Dependencies:1·Dependents:0
  2. hast utility to check if a node is interactive
  1. unist 80
  2. hast 78
  3. util 78
  4. utility 78
  5. html 61
  6. hast-util 27
  7. category 7
  8. element 5

hast-util-interactive

Build Coverage Downloads Size Sponsors Backers Chat

hast utility to check whether a node is interactive.

Install

npm:

npm install hast-util-interactive

Use

var interactive = require('hast-util-interactive')

interactive({
  type: 'element',
  tagName: 'a',
  properties: {},
  children: []
}) // => false

interactive({
  type: 'element',
  tagName: 'a',
  properties: {href: '#alpha'},
  children: []
}) // => true

interactive({
  type: 'element',
  tagName: 'video',
  properties: {controls: true},
  children: []
}) // => true

API

interactive(node)

Parameters
Returns

boolean — Whether node is an Element categorised as interactive.

Security

hast-util-interactive 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