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

<math> wrongly typed as Element instead of MathMlElement #758

Open
jelhan opened this issue Sep 3, 2024 · 0 comments
Open

<math> wrongly typed as Element instead of MathMlElement #758

jelhan opened this issue Sep 3, 2024 · 0 comments

Comments

@jelhan
Copy link

jelhan commented Sep 3, 2024

Glint types <math> as Element. It should be the more specific MathMlElement.

This is an issue in some cases. E.g. Element does not implement ElementCSSInlineStyle, which MathMlElement does. This breaks usage of ember-style-modifier on <math> elements as documented by this failing test: jelhan/ember-style-modifier#237

There is already a special handing for SVGElement in Glint:

/**
* Given a tag name, returns an appropriate `Element` subtype.
* NOTE: This will return a union for elements that exist both in HTML and SVG. Technically, this will be too permissive.
*/
export type ElementForTagName<Name extends string> = Name extends keyof HTMLElementTagNameMap
? Name extends keyof SVGElementTagNameMap
? HTMLElementTagNameMap[Name] & SVGElementTagNameMap[Name]
: HTMLElementTagNameMap[Name]
: Name extends keyof SVGElementTagNameMap
? SVGElementTagNameMap[Name]
: Element;
This needs to be extended to cover MathMlElement as well.

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