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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: join srcset in source with ", " #7918

Merged
merged 6 commits into from Apr 11, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
6 changes: 6 additions & 0 deletions packages/core/integration-tests/test/html.js
Expand Up @@ -834,6 +834,12 @@ describe('html', function () {
assets: ['300x300.png'],
},
]);

const html = await outputFS.readFile(b.getBundles()[0].filePath, 'utf8');

const source = html.match(/<source srcset=".*>/)[0];

assert(source.split(', ').length === 3);
});

it('should detect imagesrcset attribute', async function () {
Expand Down
2 changes: 1 addition & 1 deletion packages/transformers/html/src/dependencies.js
Expand Up @@ -96,7 +96,7 @@ function collectSrcSetDependencies(asset, srcset, opts) {
newSources.push(pair.join(' '));
}

return newSources.join(',');
return newSources.join(', ');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might be worth a comment explaining the significance of the trailing space

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for late response, b19e0af 👍

}

function getAttrDepHandler(attr) {
Expand Down