-
-
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
WIP: Math ml tag defs #105
Conversation
as far as i know org.scalajs.dom doesn't have support for mathml so your |
You beat the CI to it! https://github.com/Quafadas/scala-dom-types/actions/runs/10959385719/job/30431627724 I'm actually not sure whether it needs to be supported by The browser seems to render it quite happily, so I'm wondering if I just go for some base class and pray? |
I guess this is probably going to impact the attributes it can have though? Does that mean I need to make PR to scala-js-dom? |
by default sdt generates definitions like these |
i don't think it would impact the attributes since they are basically just a name and codec it would impact tags tho since they accept the generic type from org.scalajs.dom |
So I've pattern matched my way through the CI, which is green on my fork. Hopefully it's a starting point for a discussion. |
I assume, that in its curren t form, it will exhibit the same set of problems as the original bootlegged HTML. I'm not clear how to work around that though. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, that's a good start!
After looking into this a bit, I think overall, we need to treat MathML tags and attributes similarly to how we treat SVG – so they will get their own namespace in Laminar.
Indeed, as you said, for this to be meaningful, someone needs to contribute the MathMLElement interface to scalajs-dom. I think we can do without that if we just use the dom.Element
supertype for MathML elements, but that's only suitable for a PoC, it would make the types too loose in Laminar.
I think if we're adding MathML, we should add all of the MathML tags and attributes right away, especially if AI is helping with the chore. Also:
- The tags and attributes should be sorted alphabetically by their JS / DOM name in the listings
- The
<math>
tag itself should be moved to MathMlTags – it's actually a MathMlElement, not an HTMLElement (similar to the root tag)
I made an issue in Laminar to track all the related tasks: raquo/Laminar#172
shared/src/main/scala/com/raquo/domtypes/codegen/CanonicalDefGroups.scala
Show resolved
Hide resolved
shared/src/main/scala/com/raquo/domtypes/codegen/CanonicalGenerator.scala
Show resolved
Hide resolved
@raquo This passes on my fork, I'm not in a position to judge, if the tests are meaningful or not, however :-( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, good start! 🚀 Please see comments.
shared/src/main/scala/com/raquo/domtypes/defs/tags/MathMlTagDefs.scala
Outdated
Show resolved
Hide resolved
shared/src/main/scala/com/raquo/domtypes/defs/tags/MathMlTagDefs.scala
Outdated
Show resolved
Hide resolved
shared/src/main/scala/com/raquo/domtypes/defs/tags/MathMlTagDefs.scala
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, we can merge this into a new mathml
branch (pending a couple new comments).
We can merge this into master
once the feature is complete and scala-js-dom makes a release.
Is there any chance I'm hitting this? |
I can't reproduce this failure locally :-(. |
I've merged this into the new |
I will not pretend to have written any of this myself - thank you Mr AI.
In the light of the above statement, I'm not clear whether I have a better or worse chance of this actually working.
So let's poke the CI and see what happens.