Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var he = require('he');
var lowercase = require('./lowercase');
var attributes = require('./attributes');
var elements = require('./elements');
var rstart = /^<\s*([\w:-]+)((?:\s+[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)\s*>/;
var rstart = /^<\s*([\w:-]+)((?:\s*[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)\s*>/;
var rend = /^<\s*\/\s*([\w:-]+)[^>]*>/;
var rattrs = /([\w:-]+)(?:\s*=\s*(?:(?:"((?:[^"])*)")|(?:'((?:[^'])*)')|([^>\s]+)))?/g;
var rtag = /^</;
Expand Down
10 changes: 10 additions & 0 deletions test/insane.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,13 @@ test('doesn\'t care about quotes', function (t) {
t.equal(insane('"bar?"'), '"bar?"');
t.end();
});

test("HTML Parser should handle multiple attributes without spaces", function (t) {
t.equal(
insane(
'<a target="_blank" rel="noopener noreferrernofollow"target="_blank"href="https://tusi.cn/u/639278639053211787"><strong>→→→→→→more←←←←←←</strong></a>'
),
'<a target="_blank" href="https://tusi.cn/u/639278639053211787"><strong>→→→→→→more←←←←←←</strong></a>'
);
t.end();
});