init
This commit is contained in:
@@ -0,0 +1 @@
|
||||
* text=auto
|
||||
+1
@@ -0,0 +1 @@
|
||||
node_modules
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- '0.10'
|
||||
- '0.11'
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014 hemanth
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
void-elements
|
||||
==============
|
||||
|
||||
### Array of "void elements" defined by the HTML specification
|
||||
|
||||
Exports an Array of "void element" node names as defined by the HTML spec.
|
||||
|
||||
The list is programatically generated from the [latest W3C HTML draft](http://www.w3.org/html/wg/drafts/html/master/syntax.html#void-elements).
|
||||
|
||||
[](https://travis-ci.org/jadejs/void-elements)
|
||||
[](https://david-dm.org/jadejs/void-elements#info=devDependencies)
|
||||
[](https://www.npmjs.org/package/void-elements)
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
```js
|
||||
var voidElements = require('void-elements');
|
||||
|
||||
assert(voidElements.indexOf('span') === -1, '<span> is not a void element');
|
||||
assert(voidElements.indexOf('img') !== -1, '<img> is a void element');
|
||||
```
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
MIT
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* This file automatically generated from `pre-publish.js`.
|
||||
* Do not manually edit.
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
"area": true,
|
||||
"base": true,
|
||||
"br": true,
|
||||
"col": true,
|
||||
"embed": true,
|
||||
"hr": true,
|
||||
"img": true,
|
||||
"input": true,
|
||||
"keygen": true,
|
||||
"link": true,
|
||||
"menuitem": true,
|
||||
"meta": true,
|
||||
"param": true,
|
||||
"source": true,
|
||||
"track": true,
|
||||
"wbr": true
|
||||
};
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"name": "void-elements",
|
||||
"version": "2.0.1",
|
||||
"description": "Array of \"void elements\" defined by the HTML specification.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "node test",
|
||||
"prepublish": "node pre-publish.js > index.js"
|
||||
},
|
||||
"keywords": [
|
||||
"html",
|
||||
"void",
|
||||
"elements"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/hemanth/void-elements"
|
||||
},
|
||||
"author": {
|
||||
"name": "hemanth.hm"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/hemanth/void-elements/issues"
|
||||
},
|
||||
"homepage": "https://github.com/hemanth/void-elements",
|
||||
"devDependencies": {
|
||||
"cheerio": "^0.18.0"
|
||||
},
|
||||
"readme": "void-elements\r\n==============\r\n\r\n### Array of \"void elements\" defined by the HTML specification\r\n\r\nExports an Array of \"void element\" node names as defined by the HTML spec.\r\n\r\nThe list is programatically generated from the [latest W3C HTML draft](http://www.w3.org/html/wg/drafts/html/master/syntax.html#void-elements).\r\n\r\n[](https://travis-ci.org/jadejs/void-elements)\r\n[](https://david-dm.org/jadejs/void-elements#info=devDependencies)\r\n[](https://www.npmjs.org/package/void-elements)\r\n\r\nUsage\r\n-----\r\n\r\n```js\r\nvar voidElements = require('void-elements');\r\n\r\nassert(voidElements.indexOf('span') === -1, '<span> is not a void element');\r\nassert(voidElements.indexOf('img') !== -1, '<img> is a void element');\r\n```\r\n\r\nLicense\r\n-------\r\n\r\nMIT\r\n",
|
||||
"readmeFilename": "README.md",
|
||||
"_id": "void-elements@2.0.1",
|
||||
"dist": {
|
||||
"shasum": "3b2361460e371ea9f29813859888b296b8d3ec17"
|
||||
},
|
||||
"_from": "void-elements@~2.0.1",
|
||||
"_resolved": "https://registry.npmjs.org/void-elements/-/void-elements-2.0.1.tgz"
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
var cheerio = require('cheerio')
|
||||
, http = require('http');
|
||||
|
||||
http.get('http://www.w3.org/html/wg/drafts/html/master/syntax.html', function (res) {
|
||||
var str = '';
|
||||
res.setEncoding('utf8');
|
||||
res.on('data', function (buf) {
|
||||
str += buf;
|
||||
}).on('end', function () {
|
||||
var $ = cheerio.load(str);
|
||||
var codes = $('dfn#void-elements')
|
||||
.parent()
|
||||
.next()
|
||||
.text()
|
||||
.replace(/\s/gm,'')
|
||||
.split(",")
|
||||
.reduce(function (obj, code) {
|
||||
obj[code] = true;
|
||||
return obj;
|
||||
}, {});
|
||||
|
||||
console.log('/**');
|
||||
console.log(' * This file automatically generated from `pre-publish.js`.');
|
||||
console.log(' * Do not manually edit.');
|
||||
console.log(' */');
|
||||
console.log();
|
||||
console.log('module.exports = %s;', JSON.stringify(codes, null, 2));
|
||||
});
|
||||
});
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
var assert = require('assert');
|
||||
var voidElements = require('../');
|
||||
assert(!voidElements.span, '<span> is not a void element');
|
||||
assert(voidElements.img, '<img> is a void element');
|
||||
console.log('tests passed');
|
||||
Reference in New Issue
Block a user