-
Notifications
You must be signed in to change notification settings - Fork 68
Closed
Description
svg tags can have an attribute named "xmlns:xlink". For example:
<svg aria-hidden="true" style="position: absolute; width: 0; height: 0; overflow: hidden;" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
When parsed by HTML.parse it incorrectly parses the tags.
test script: ast_test.ts
import HTML from 'html-parse-stringify';
export const problemSvg = `<svg aria-hidden="true" style="position: absolute; width: 0; height: 0; overflow: hidden;" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" data-webdiff-id="175">
</svg>`;
const problem = HTML.parse(problemSvg);
console.log('problem', problem);output:
$ ./node_modules/.bin/ts-node ast_test.ts
problem [ { type: 'tag',
name: 'svg',
voidElement: false,
attrs:
{ 'aria-hidden': 'true',
style: 'position: absolute; width: 0; height: 0; overflow: hidden;',
version: '1.1',
xmlns: 'xlink',
'"http://www.w3.org/1999/xlink"': 'data-webdiff-id' },
children: [ [Object], [Object] ] } ]
Metadata
Metadata
Assignees
Labels
No labels