optional-tags
v0.0.4
Published
Array of "optional tags" defined by the HTML specification.
Downloads
5
Readme
optional-tags
Exports optional html tags with some levels, Constrainted by w3.org#optional-tags.
For some reason, we can omit element's start tag or end tag like this (comply with a standard):
<!doctype html><html lang="en"><link><base><body><ul><li>say hi<p>it's all we need</ul>
Why omit the tags? (unfinished drafts):
- Optimize transfer:
- Improve performance:
- Make easier to handle white-space processing model
- Doesn't affect the performance of the browser
Example
var optionalTags = require('optional-tags')
// recommend
var safeTags = optionalTags(true) // or 'safe', or undefined
console.log( 'safe start tags: ', safeTags.starts.join(', ') )
console.log( 'safe end tags: ', safeTags.join(', ') )
// recommend, but make sure you don't use any comments or space character
var radicalTags = optionalTags('radical')
console.log( 'radical start tags: ', radicalTags.starts.join(', ') )
console.log( 'radical end tags: ', radicalTags.ends.join(', ') )