Skip to content

Commit 749734e

Browse files
committed
Merge pull request #8 from 'markcarver/patch-1'
2 parents d0f0086 + 20aa078 commit 749734e

File tree

2 files changed

+3
-23
lines changed

2 files changed

+3
-23
lines changed

lib/parse-tag.js

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,5 @@
11
var attrRE = /([\w-]+)|(['"])([.\s\S]*?)\2/g;
2-
3-
// create optimized lookup object for
4-
// void elements as listed here:
5-
// http://www.w3.org/html/wg/drafts/html/master/syntax.html#void-elements
6-
var lookup = (Object.create) ? Object.create(null) : {};
7-
lookup.area = true;
8-
lookup.base = true;
9-
lookup.br = true;
10-
lookup.col = true;
11-
lookup.embed = true;
12-
lookup.hr = true;
13-
lookup.img = true;
14-
lookup.input = true;
15-
lookup.keygen = true;
16-
lookup.link = true;
17-
lookup.menuitem = true;
18-
lookup.meta = true;
19-
lookup.param = true;
20-
lookup.source = true;
21-
lookup.track = true;
22-
lookup.wbr = true;
2+
var voidElements = require('void-elements');
233

244
module.exports = function (tag) {
255
var i = 0;
@@ -37,7 +17,7 @@ module.exports = function (tag) {
3717
key = match;
3818
} else {
3919
if (i === 0) {
40-
if (lookup[match] || tag.charAt(tag.length - 2) === '/') {
20+
if (voidElements[match] || tag.charAt(tag.length - 2) === '/') {
4121
res.voidElement = true;
4222
}
4323
res.name = match;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"url": "https://github.com/rayd/html-parse-stringify2/issues"
88
},
99
"dependencies": {
10-
"void-elements": "^1.0.0"
10+
"void-elements": "^2.0.1"
1111
},
1212
"devDependencies": {
1313
"jshint": "^2.5.10",

0 commit comments

Comments
 (0)