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

MathMl attributes #106

Open
Quafadas opened this issue Dec 15, 2024 · 2 comments
Open

MathMl attributes #106

Quafadas opened this issue Dec 15, 2024 · 2 comments

Comments

@Quafadas
Copy link

See #105 -

No – there's a difference between markup attributes and DOM properties. The properties are what's missing – as evidenced by undefined in the browser, as we've seen. But the attributes of course still exist. I'm not proficient in mathml, but I assume that specifying them is in fact needed to accomplish some things.

Markup attributes are typically specified in the mathml markup, but they can also be set via JS, like this: $0.setAttribute('displaystyle', 'normal') (You can try that on this page, if you inspect & select the element in their example – you will see the formula change its layout.

Looks like this is the list of attributes: https://developer.mozilla.org/en-US/docs/Web/MathML/Attribute

Don't add the ones with the trash icon.

With the attributes, the most important thing is to get their types /codecs right. See the types in the table above.

If the type is not mentioned, it's just a string, so for them the codec would be just StringAsIs.
At the moment we encode enum-type values as strings as well – just specify their allowed values in the scaladoc.
For booleans, this page says they they are encoded as "true" and "false" strings, so for that, we should use BooleanAsTrueFalseStringCodec
If not sure about a particular attribute, just set the type to string. It's a safe fallback, because all those values are represented as strings in the mathml markup.
If it's not too much work, it would be nice to indicate which element(s) each of these applies to in the scaladoc (the info is in the table)

@Quafadas
Copy link
Author

Quafadas commented Jan 4, 2025

@raquo thanks for your help on the previous issue - I’m waiting for my mathml curiosity to come back after a busy period at work, or scala ja dom to release… whichever comes first.

i haven’t forgotten this though.

@raquo
Copy link
Owner

raquo commented Jan 4, 2025

Sure, no rush!

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

2 participants