Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including hast-util-interactive with all npm packages installed. Try it out:

var hastUtilInteractive = require("hast-util-interactive")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

hast-util-interactive v1.0.2

Check if a node is interactive

hast-util-interactive Build Coverage Downloads Chat

Check whether a HAST node is interactive.

Installation

npm:

npm install hast-util-interactive

Usage

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
  • node (Node, optional) — Node to check.
Returns

boolean — Whether node is an Element categorised as interactive.

Contribute

See contributing.md in syntax-tree/hast for ways to get started.

This organisation has a Code of Conduct. By interacting with this repository, organisation, or community you agree to abide by its terms.

License

MIT © Titus Wormer

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free