Skip to content

Commit

Permalink
add <image> as a valid element type to bundle in <svg> tags (w/ tests) (
Browse files Browse the repository at this point in the history
  • Loading branch information
makmm authored and devongovett committed Oct 6, 2018
1 parent 1afb3e8 commit f8aa228
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/core/parcel/src/assets/HTMLAsset.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const ATTRS = {
href: ['link', 'a', 'use'],
srcset: ['img', 'source'],
poster: ['video'],
'xlink:href': ['use'],
'xlink:href': ['use', 'image'],
content: ['meta'],
data: ['object']
};
Expand Down
17 changes: 17 additions & 0 deletions packages/core/parcel/test/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,23 @@ describe('html', function() {
});
});

it('should bundle svg files using <image xlink:href=""> correctly', async function() {
let b = await bundle(
path.join(__dirname, '/integration/html-svg-image/index.html')
);

await assertBundleTree(b, {
name: 'index.html',
assets: ['index.html'],
childBundles: [
{
type: 'svg',
assets: ['file.svg']
}
]
});
});

it('should support data attribute of object element', async function() {
let b = await bundle(
path.join(__dirname, '/integration/html-object/index.html')
Expand Down
3 changes: 3 additions & 0 deletions packages/core/parcel/test/integration/html-svg-image/file.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<!DOCTYPE html>
<svg xmlns:xlink="http://www.w3.org/1999/xlink">
<image xlink:href="file.svg"/>
</svg>

0 comments on commit f8aa228

Please sign in to comment.