Skip to content

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

Open
@jelhan

Description

@jelhan

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions