Skip to content
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

Type VNode and VDomModifier #260

Open
cornerman opened this issue Nov 13, 2018 · 0 comments
Open

Type VNode and VDomModifier #260

cornerman opened this issue Nov 13, 2018 · 0 comments

Comments

@cornerman
Copy link
Member

We could make VNode generic on its actual dom type. So div could be of type dom.html.Div and so forth. That would mean we have HtmlVNode[E <: dom.html.Element] and SvgNode[E <: dom.svg.Element]. Then we could have an apply method which takes a VDomModifier[dom.html.Element] respectively VDomModifier[dom.svg.Element], thereby we could only apply html attrs to html tags and the same for svg.

Furthermore, we could try to make our EmitterBuilder[dom.Event, R] work with this information. it would be great to have a typesafe way to access the current element from a dom event or hook. Then you could have input( onDomMount.foreach { elem: dom.html.Input => ??? }, onInput.map(_.currentTarget.value) --> sink).

We have helpers like onInput.value as of now but they are not typesafe but just cast to an input element and assumes the value property exists (see #93). We want the compiler to tell us about these problems.

PR #237 makes a first step.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant