-
-
Notifications
You must be signed in to change notification settings - Fork 16
Closed
Description
I recently started using this library ... and thank you for this! My parsing logic was very bad and wrong. I got a user issue reported over here:
JustinBeckwith/linkinator#511
Which basically boils down to the library not really properly parsing srcset values if there are gratuitous newlines and spaces strewn about. The following shows what's happenin:
import {parseSrcset} from 'srcset';
let value, result;
value = `/docs/v1/assets/img/bootstrap-icons.png,
/docs/v1/assets/img/bootstrap-icons@2x.png 2x`;
result = parseSrcset(value);
console.log(result);
// result: [ { url: '/docs/v1/assets/img/bootstrap-icons.png,', density: 2 } ]
value = '/docs/v1/assets/img/bootstrap-icons.png, /docs/v1/assets/img/bootstrap-icons@2x.png 2x';
result = parseSrcset(value);
console.log(result);
// result: [
// { url: '/docs/v1/assets/img/bootstrap-icons.png' },
// { url: '/docs/v1/assets/img/bootstrap-icons@2x.png', density: 2 }
// ]Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels