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
17 changes: 17 additions & 0 deletions packages/core/integration-tests/test/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -965,6 +965,23 @@ describe('html', function () {
]);
});

it("should support href attribute in <image /> in HTMLTransformer's collectDependencies", async function () {
let b = await bundle(
path.join(__dirname, '/integration/html-image-href-attr/index.html'),
);

assertBundles(b, [
{
name: 'index.html',
assets: ['index.html'],
},
{
type: 'png',
assets: ['100x100.png'],
},
]);
});

// Based on https://developer.mozilla.org/en-US/docs/Web/SVG/Element/script
it('should bundle scripts inside svg', async function () {
let b = await bundle(
Expand Down
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,13 @@
<!doctype html>
<html>

<head>
</head>

<body>
<svg>
<image href="./100x100.png" />
</svg>
</body>

</html>
2 changes: 1 addition & 1 deletion packages/transformers/html/src/dependencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const ATTRS = {
'amp-img',
],
// Using href with <script> is described here: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/script
href: ['link', 'a', 'use', 'script'],
href: ['link', 'a', 'use', 'script', 'image'],
srcset: ['img', 'source'],
imagesrcset: ['link'],
poster: ['video'],
Expand Down