Name: dom-nodes
Owner: Riot
Description: List of all the available DOM and SVG nodes and helper functions to quickly test against them
Created: 2018-02-10 15:44:50.0
Updated: 2018-04-16 03:03:36.0
Pushed: 2018-02-11 20:42:48.0
Homepage: null
Size: 18
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
m i dom-nodes -S
rt {isVoid} from 'dom-nodes'
id('div') // false
id('img') // true
dom-nodes
exports all the methods listed below giving you some simple tests to understand which kind of node you are dealing with.
This project includes html-tags and svg-tag-names directly in its source code avoiding to rely on third party npm modules for such simple list of strings. This project couldn't have been made without the projects above!
SVG void elements that cannot be auto-closed and shouldn't contain child nodes.
Type: Array
List of all the available svg tags
Type: Array
HTML void elements that cannot be auto-closed and shouldn't contain child nodes.
List of all the html tags
Type: Array
List of all boolean HTML attributes
Type: RegExp
Regex matching all the html tags ignoring the cases
Type: RegExp
Regex matching all the svg tags ignoring the cases
Type: RegExp
Regex matching all the void html tags ignoring the cases
Type: RegExp
Regex matching all the void svg tags ignoring the cases
Type: RegExp
Regex matching all the boolean attributes
Type: RegExp
True if it's a self closing tag
Parameters
tag
String test tagExamples
id('meta') // true
id('circle') // true
id('IMG') // true
id('div') // false
id('mask') // false
Returns Boolean
True if it's a known HTML tag
Parameters
tag
String test tagExamples
ml('img') // true
ml('IMG') // true
ml('Img') // true
ml('path') // false
Returns Boolean
True if it's a known SVG tag
Parameters
tag
String test tagExamples
g('g') // true
g('radialGradient') // true
g('radialgradient') // true
g('div') // false
Returns Boolean
True if it's not SVG nor a HTML known tag
Parameters
tag
String test tagExamples
stom('my-component') // true
stom('div') // false
Returns Boolean
True if it's a boolean attribute
Parameters
attribute
String test attributeExamples
olAttribute('selected') // true
olAttribute('class') // false
Returns Boolean