0.1.0 • Published 10 years ago

selector2tag v0.1.0

Weekly downloads
3
License
MIT
Repository
github
Last release
10 years ago

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.