data
data copied to clipboard
Add SVG data
It would be helpful to have also SVG related data.
Optimizers like svgo heavily use such data, see https://github.com/svg/svgo/blob/master/plugins/_collections.js .
Some svgo plugins also define extra data:
- https://github.com/svg/svgo/blob/master/plugins/removeUselessStrokeAndFill.js
- https://github.com/svg/svgo/blob/master/plugins/removeUnusedNS.js
- https://github.com/svg/svgo/blob/master/plugins/removeUnknownsAndDefaults.js
- https://github.com/svg/svgo/blob/master/plugins/_path.js
- https://github.com/svg/svgo/blob/master/plugins/_transforms.js
- https://github.com/svg/svgo/blob/master/plugins/convertStyleToAttrs.js
- https://github.com/svg/svgo/blob/master/plugins/cleanupNumericValues.js
- https://github.com/svg/svgo/blob/master/plugins/cleanupListOfValues.js
Further interesting data for SVG: Which attributes allow color-, dimension-, number-, string-, url-values? This avoids blindly iterating over all values and trying to match them with multiple regexps for example.
Relevant Bugzilla discussions: https://bugzilla.mozilla.org/show_bug.cgi?id=1214725 https://bugzilla.mozilla.org/show_bug.cgi?id=1212826
Just wanted to mention that csstype
is a project which generates CSS type definition files for TypeScript and Flow from the MDN data. It's now being used in the typings for React as well as a growing number of CSS-in-JS libraries. So it would benefit a lot of high-profile libraries and their many users if the MDN data were complete 😄
I could work on this, but not sure how to start. @lahmatiy any suggestions?
Would this be a good source for start: https://www.w3.org/TR/SVGTiny12/index.html ?
I added https://github.com/frenic/csstype/blob/master/src/data/svg.ts based on https://svgwg.org/svg2-draft/propidx.html as a temporarily solution until this is solved.
@pkuczynski I think https://www.w3.org/TR/SVG2/ should be a source of truth. But that spec is huge and property definitions aren't located in one place. I can suggest to add properties in parts.
Oh, I forgot about property index appendix. Thank you @frenic for pointing out. @pkuczynski I think that link https://www.w3.org/TR/SVG2/propidx.html can be used too
And here one problem: some SVG styling property names intersect with regular one and have differ syntax. We need to decide what to do with that issue.
@lahmatiy I think the last comment relates to #144, requesting the ability to specify attribute support by tag. This is not currently supported, isn't it?
Also please note that @JeremiePat is working on improving the SVG docs on MDN at the moment, and as part of that is looking into moving SVG data (that's currently embedded in MDN macros) into this repository. So he might be able to help :).
https://discourse.mozilla.org/t/time-to-lift-up-the-svg-documentation-to-the-next-level/25529 https://discourse.mozilla.org/t/cleaning-svg-macro/27192
Yes, and I'm following that discussion very closely. At that point and based on the feed back I got so far I do not plan to do any hard change in where the data are hosted at the moment.
That said, rationalizing MDN data about SVG is definitely in my scope for the next months. At that point, the only thing I know for sure is that the SVG2 spec is the source of truth regarding SVG specification. But even like that the spec is still in flux on some points so there is no rush on my side.
@JeremiePat should I then not work on this for now?
@pkuczynski Actually, it's quite the opposite. As I do not plan to do any big change in the short term, I would love to assist you with the ongoing work here. Please feel free to lead and I'll assist as much as I can.
An additional reference: https://github.com/Fyrd/caniuse/issues/3 ("SVG feature coverage").
What's the word on this?
would love an update on this