raquo/scala-dom-types

Merge colliding html and svg attr names into shared namespace.

Closed this issue · 3 comments

busti commented

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.

raquo commented

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.

busti commented

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.

raquo commented

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.