-
-
Notifications
You must be signed in to change notification settings - Fork 28
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
SVG support #20
Comments
Basically we'd need to define SVG tags and attributes in the same manner as we defined those for HTML elements. So in terms of types it's all very similar to what we already have. If I recall correctly, ScalaTags already has those listings. I'm not sure how complete those are, as we saw we needed quite a bit of work to get its HTML attribute listings to our desired shape. However, I haven't looked at SVG spec in detail. I don't know how complicated the types are, and whether we'd need reflected attributes for SVG elements. So, in practical terms, to a first approximation, we need to:
Unfortunately I don't think I'll have the time to do all this work any time soon (I also don't expect my own need for SVG in the next few months), so you'll need to carry the load on this one, sorry. I can still help with soft stuff like advice / reviews / design. For reference: https://developer.mozilla.org/en-US/docs/Web/SVG |
Thank you for the explanation, I will give it a try soon. |
Would like to work on this together ,what's the current status? |
Is it possible to provide some implicits and reuse part of |
@doofin Probably, but it would need to be part of your app, not part of SDT. You can create a |
@doofin Nice, let's do that together. I think I will have some time tomorrow to start on a branch. |
@fdietze Great! I think we can just copy-paste lots of code from scalatags. |
@raquo thanks! After adding svg support for scala dom types ,how to add that to laminar? |
@doofin As a starting point, Laminar's Laminar will probably need a bunch of changes to introduce the distinction between DOM Elements and DOM HTMLElements. Some of those changes will actually need to happen in Scala DOM Builder, and maybe even also in Scala DOM TestUtils. I was anticipating an eventual need for this distinction from the very beginning and can deal with the Laminar / SDB side of things once the design of SVG support in SDT is established. |
PS if borrowing code from ScalaTags please make sure to preserve any "MDN" marking in the comments – this is an indicator for a different license which we also honor in SDT's license. |
@raquo Thanks,we do have to pay attention to license while using code from other project |
I have added the svgAttrs file and a few props,please check their correctness |
It seems that pull requests page is not a good place to put information,for that a merge would permanently close the pr,so I put everything here: For reference:
fixes #20 |
It seems that |
Let's clear up the terminology first. When I said "choose to namespace everything svg-related" I meant that consuming libraries such as Scala DOM Builder and Laminar will be responsible for making an Now there's also the XML/SVG namespacing that you're referring to now, let's think how to deal with that. Dom Builder has a I think createNode should really be called createElement, and we need a new method called createElementNs that we would use for namespaced SVG. Now, Roughly I think that's the idea. I didn't have a chance to look deeper into this yet, sorry. |
@doofin So we will need to start working this up the chain to Scala DOM Builder, and at that point we will need to make a simple test, and for this I need an example SVG file from you. It should have a few different SVG elements in it (not more than 10), and those elements should have attributes which accept different kinds of values – for example numbers and strings, or I don't know, booleans? The more different types the better. This SVG file should render something obvious like maybe geometric shapes of various colors and sizes. We will then take this SVG file and use it as a test case in Scala DOM Builder to make sure that our functionality works. |
@raquo Great! I have started a PR on dom builder and with more time I will look more closely to reviews and improve |
@doofin Awesome, thanks! |
What needs to be done to support SVG? I'll need this soon.
The text was updated successfully, but these errors were encountered: