|
|
5 روز پیش | |
|---|---|---|
| .. | ||
| index.js | 5 روز پیش | |
| license | 5 روز پیش | |
| package.json | 5 روز پیش | |
| readme.md | 5 روز پیش | |
hast utility to check if a node is a (certain) element.
npm:
npm install hast-util-is-element
var is = require('hast-util-is-element')
is({type: 'text', value: 'foo'}) // => false
is({type: 'element', tagName: 'a'}, 'a') // => true
is({type: 'element', tagName: 'a'}, ['a', 'area']) // => true
isElement(node[, tagName|tagNames])Check if the given value is a (certain) element.
tagName or tagNames, checks that node is an
element whose tagName field matches tagName or is included
in tagNamesnode is an elementnode (*) — Value to check, probably NodetagName (string, optional) — Value that nodes tagName field should
matchtagNames (Array.<string>, optional) — Values that should include nodes
tagName field should matchboolean — whether node passes the test.
Error — When the second parameter is given but invalid.
hast-util-is-element 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, organization, or community you agree to abide by its terms.