albell / parse-srcset Goto Github PK
View Code? Open in Web Editor NEWA spec-conformant JavaScript parser for the HTML5 srcset attribute
License: MIT License
A spec-conformant JavaScript parser for the HTML5 srcset attribute
License: MIT License
Would like to see this on jsDelivr.
This parser is friggin’ amazing, and we’d love to have you involved in Picturefill.
We’ve started putting a more formal team together for the project, and this parser completely blows mine out of the water in terms of accuracy, efficiency, and code organization—would you be interested in teaming up?
Would be useful
https://github.com/baloneysandwiches/parse-srcset/blob/master/parse-srcset.js#L26
spec
https://html.spec.whatwg.org/multipage/infrastructure.html#valid-non-negative-integer
Leading + or - is not allowed.
((intVal >= 0)
can be removed also.)
Hi, could you make a new release and publish it on npmjs?
https://github.com/baloneysandwiches/parse-srcset/blob/master/parse-srcset.js#L31
spec
https://html.spec.whatwg.org/multipage/infrastructure.html#valid-floating-point-number
The + is not allowed. The rest of the regex is correct AFAICT.
The inline documentation says that the `x' descriptor is exposed a 'x', but instead it is exposed as 'd'.
I would prefer, if it would be the x key, because every candidate has a computable pixel density. So the d can be used to bring sizes
and w descriptor together.
Hi
I'm struggling with parsing srcsets where the urls in the srcset have commas in them.
I've had a look at your code, which seems very thorough, but looks like you render a parse error when a URL has a comma in it?
Is that right?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.