Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/plugins/source-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,27 @@ const defaultAttributes = [
attribute: 'src',
type: 'src',
},
// SVG
{
tag: 'image',
attribute: 'xlink:href',
type: 'src',
},
{
tag: 'image',
attribute: 'href',
type: 'src',
},
{
tag: 'use',
attribute: 'xlink:href',
type: 'src',
},
{
tag: 'use',
attribute: 'href',
type: 'src',
},
];

function parseSource(source) {
Expand Down
234 changes: 201 additions & 33 deletions test/__snapshots__/attributes-option.test.js.snap

Large diffs are not rendered by default.

66 changes: 57 additions & 9 deletions test/__snapshots__/esModule-option.test.js.snap

Large diffs are not rendered by default.

22 changes: 19 additions & 3 deletions test/__snapshots__/loader.test.js.snap

Large diffs are not rendered by default.

86 changes: 70 additions & 16 deletions test/__snapshots__/minimize-option.test.js.snap

Large diffs are not rendered by default.

18 changes: 16 additions & 2 deletions test/fixtures/simple.html
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,6 @@ <h2>An Ordered HTML List</h2>

<div data-videomp4="video.mp4"></div>

<use xlink:href="vector.svg" />

<![CDATA[<img src="image.png">]]><img src="image.png">

<link rel="stylesheet" type="text/css" href="./style.file.css">
Expand Down Expand Up @@ -275,3 +273,19 @@ <h2>An Ordered HTML List</h2>
<img data-srcset="image.png 480w, image.png 800w" sizes="(max-width: 600px) 480px, 800px" data-src="image.png" alt="Elva dressed as a fairy">

<img src=~aliasImageWithSpace#hash />

<svg width="200" height="200">
<image xlink:href="./webpack.svg" height="200" width="200"/>
</svg>

<svg width="200" height="200">
<image href="./webpack.svg" height="200" width="200"/>
</svg>

<svg width="200" height="200">
<use href="./webpack.svg"></use>
</svg>

<svg width="200" height="200">
<use xlink:href="./webpack.svg"></use>
</svg>
1 change: 1 addition & 0 deletions test/fixtures/webpack.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.