selector2tag
v0.1.0
Published
Utility function to build individual HTML tags from CSS selectors.
Downloads
2
Readme
selector2tag
Utility function to build individual HTML tags from CSS selectors. Uses Slick's parser for most of the hard work. I should rework it to build multiple tags.
Example
var sel2tag = require('selector2tag');
var wrap = sel2tag('main#content.wrapper.foo[role="main"][bar]');
var result = wrap.openingTag + 'Hello World' + wrap.closingTag;
Result:
<main id="content" class="wrapper foo" role="main" bar>Hello World</main>
The tag name defaults to div
.