Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

add <image> as a valid element type to bundle in <svg> tags (w/ tests) #2113

Merged
merged 5 commits into from Oct 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/assets/HTMLAsset.js
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 test/html.js
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 test/integration/html-svg-image/file.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions test/integration/html-svg-image/index.html
@@ -0,0 +1,4 @@
<!DOCTYPE html>
<svg xmlns:xlink="http://www.w3.org/1999/xlink">
<image xlink:href="file.svg"/>
</svg>