Skip to content

Commit f9be820

Browse files
jdanyowdevongovett
authored andcommitted
support svg <use> elements (#612)
1 parent d7098ce commit f9be820

4 files changed

Lines changed: 13 additions & 1 deletion

File tree

src/assets/HTMLAsset.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ const ATTRS = {
2020
'embed'
2121
],
2222
href: ['link', 'a'],
23-
poster: ['video']
23+
poster: ['video'],
24+
'xlink:href': ['use']
2425
};
2526

2627
class HTMLAsset extends Asset {

test/html.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ describe('html', function() {
1010
name: 'index.html',
1111
assets: ['index.html'],
1212
childBundles: [
13+
{
14+
type: 'svg',
15+
assets: ['icons.svg'],
16+
childBundles: []
17+
},
1318
{
1419
type: 'css',
1520
assets: ['index.css'],

test/integration/html/icons.svg

Lines changed: 5 additions & 0 deletions
Loading

test/integration/html/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@ <h1>Hello world</h1>
1212
<script src="index.js"></script>
1313
<script src="https://unpkg.com/parcel-bundler"></script>
1414
<i>hello</i> <i>world</i>
15+
<svg><use xlink:href="icons.svg#icon-repo-pull"></use></svg>
1516
</body>
1617
</html>

0 commit comments

Comments
 (0)