diff --git a/lib/parse-tag.js b/lib/parse-tag.js index a589961..d1c1c9f 100644 --- a/lib/parse-tag.js +++ b/lib/parse-tag.js @@ -1,7 +1,7 @@ -var attrRE = /([\w-]+)|['"]{1}([^'"]*)['"]{1}/g; +var attrRE = /([\w-]+)|(['"])(.*?)\2/g; // create optimized lookup object for -// void elements as listed here: +// void elements as listed here: // http://www.w3.org/html/wg/drafts/html/master/syntax.html#void-elements var lookup = (Object.create) ? Object.create(null) : {}; lookup.area = true; @@ -42,7 +42,7 @@ module.exports = function (tag) { } res.name = match; } else { - res.attrs[key] = match.replace(/['"]/g, ''); + res.attrs[key] = match.replace(/^['"]|['"]$/g, ''); } } i++; diff --git a/test/parse-tag.js b/test/parse-tag.js index dfc3d11..157dfa5 100644 --- a/test/parse-tag.js +++ b/test/parse-tag.js @@ -53,5 +53,19 @@ test('parseTag', function (t) { children: [] }); + tag = '