scala-dom-types icon indicating copy to clipboard operation
scala-dom-types copied to clipboard

Merge colliding html and svg attr names into shared namespace.

Open busti opened this issue 4 years ago • 2 comments

I would like to merge colliding html and svg attribute names into a shared definition.
Attrs like height or href exist in both html and svg so when we import both dsl._ and dsl.svg._ then this code a(href := "example.com") causes a compiler error until we rename one of the attrs: import dsl.svg.{href => svgHref, _}.

I would like to create a third attr definition file which contains all colliding attrs which could then be used in both svg and html tags.

Ideally I would like to do the same for tags, but thats where things get a little more complicated since they would also have to produce the correct element based on context and that would probably require some implicit conversion magic.

In this issue I would like to hear some feedback on the general idea before I go forth with implementing this.

busti avatar Sep 09 '21 02:09 busti

Hey, that's an interesting issue! Sorry I'm not super responsive right now, I should be able to take a look at this in depth around next weekend.

raquo avatar Sep 13 '21 05:09 raquo

No worries. I have found a workflow that allows me to use my updated branch while working on the related outwatch pull request.

This kinda depends on #70 but I do not want to make any this extreme changes in that PR. This proposal would probably break existing implementations while #70 does not.

busti avatar Sep 13 '21 16:09 busti

The new code generator developed in #89 can do this, if you rename the keys to prevent naming conflicts.

This kind of decision is now up to the consuming libraries. For Laminar, I gave it some more thought, and decided to keep the types as-is for now.

raquo avatar Dec 04 '22 09:12 raquo