From 2e33574dfd45201379b60c3219b7ca26a4bb1402 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Calvin=20Ju=C3=A1rez?= Date: Tue, 23 Jun 2020 20:52:07 -0600 Subject: [PATCH] Add test for #318 --- .../parse5/test/location-info-parser.test.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/packages/parse5/test/location-info-parser.test.js b/packages/parse5/test/location-info-parser.test.js index 677869a9..670c897d 100644 --- a/packages/parse5/test/location-info-parser.test.js +++ b/packages/parse5/test/location-info-parser.test.js @@ -183,3 +183,19 @@ exports['Updating node source code location (GH-314)'] = function() { end: { line: 1, column: 33, offset: 32 } }); }; + +exports['Tree adapter: htmlparser2 - Regression - SVG camel case attr location lookup (GH-318)'] = function() { + const treeAdapter = treeAdapters.default; + const document = parse5.parseFragment('', { + treeAdapter, + sourceCodeLocationInfo: true + }); + const svg = document.childNodes[0]; + const attributeLocations = svg.sourceCodeLocation.attrs; + + svg.attrs.forEach(attr => { + const name = attr.prefix ? `${attr.prefix}:${attr.name}` : attr.name; + + assert.strictEqual(name in attributeLocations, true); + }); +};