-
Notifications
You must be signed in to change notification settings - Fork 124
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
xilem_html: Add MathML and SVG elements/DOM interface traits #153
xilem_html: Add MathML and SVG elements/DOM interface traits #153
Conversation
…sing MathML and raw SVG
@@ -340,7 +340,7 @@ event_definitions!( | |||
(OnFocusIn, "focusin", FocusEvent), | |||
(OnFocusOut, "focusout", FocusEvent), | |||
(OnFormData, "formdata", Event), | |||
(OnInput, "input", InputEvent), | |||
(OnInput, "input", Event), |
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.
Ah HTML/DOM is pulling my hair out...
For some reason <input type=range>
uses the Event
interface instead of InputEvent
when using on_input
, so that's the reason, why this takes the general Event
type...
@@ -0,0 +1,4 @@ | |||
<!DOCTYPE html> | |||
<title>Pythagorean theorem</title> |
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.
I'm surprised this doesn't need a head
- I thought <!DOCTYPE html>
enabled HTML 5, which required a <head>
element
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.
Yeah I was interested, what the minimum required valid HTML is, and it seems, that just a <title>
is required.
But this will be transformed anyway by trunk, so the generated html looks more typical.
How was the generation done? IMO it would be good to include the generation script in the PR / repo too. Such that the types can be easily updated in future if needed. |
Actually a super quick n dirty hack using But if there's real need I can put it online somewhere. |
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.
LGTM. I'm excited to have a go with non-html elements.
I personally don't think we need to go into webidl land - there aren't as many elements as there are webidl interfaces. |
Yes that's my thinking too, I just used it, because I started with something else previously (which was discarded), and it was just a low hanging fruit to adopt it to quickly generate all the DOM interfaces (was also good to check whether the rest of the code is correct via static analysis). |
This adds all remaining elements that are allowed in an HTML body (to my knowledge). There are still elements missing that aren't allowed in the body (such as
<head>
), not sure whether it makes sense to add support for them too...(And deprecated elements, but I don't think it makes sense to add them)
This means all MathML elements and (raw) SVG elements.
Additionally this adds an example of the Pythagorean theorem showing raw MathML and SVG in action.
The SVG DOM interfaces are generated out of webidl files (the ones used in
web_sys
), the SVG elements were taken from here.