Skip to content

Commit c3bc86b

Browse files
committed
Merge pull request webpack-contrib#51 from werk85/master
Attribute colon support added including tests
2 parents 58bea83 + 775f435 commit c3bc86b

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

lib/attributesParser.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ var parser = new Parser({
2727
inside: {
2828
"\\s+": true, // eat up whitespace
2929
">": "outside", // end of attributes
30-
"(([0-9a-zA-Z\\-]+)\\s*=\\s*\")([^\"]*)\"": processMatch,
31-
"(([0-9a-zA-Z\\-]+)\\s*=\\s*\')([^\']*)\'": processMatch,
32-
"(([0-9a-zA-Z\\-]+)\\s*=\\s*)([^\\s>]+)": processMatch
30+
"(([0-9a-zA-Z\\-:]+)\\s*=\\s*\")([^\"]*)\"": processMatch,
31+
"(([0-9a-zA-Z\\-:]+)\\s*=\\s*\')([^\']*)\'": processMatch,
32+
"(([0-9a-zA-Z\\-:]+)\\s*=\\s*)([^\\s>]+)": processMatch
3333
}
3434
});
3535

test/parserTest.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ function test(name, html, result) {
88
if(tag === "img" && attr === "src") return true;
99
if(tag === "link" && attr === "href") return true;
1010
if(tag === "div" && attr === "data-videomp4") return true;
11+
if(tag === "use" && attr === "xlink:href") return true;
1112
return false;
1213
}).map(function(match) { return match.value }).should.be.eql(result);
1314
});
@@ -29,7 +30,8 @@ describe("parser", function() {
2930
test("tags", '<img src="image.png"><script src="script.js"></script><link type="stylesheet" href="style.css">', ["image.png", "style.css"]);
3031
test("cdata", '<![CDATA[<img src="image.png">]]><img src="image2.png">', ["image2.png"]);
3132
test("doctype", '<!doctype html><img src="image.png">', ["image.png"]);
32-
test("alphanumeric", '<div data-videomp4="video.mp4"></div>', ["video.mp4"]);
33+
test("alphanumeric", '<div data-videomp4="video.mp4"></div>', ["video.mp4"]);
34+
test("use", '<use xlink:href="vector.svg" />', ["vector.svg"]);
3335
});
3436

3537
describe("locations", function() {

0 commit comments

Comments
 (0)