Skip to content
This repository was archived by the owner on Apr 11, 2024. It is now read-only.
This repository was archived by the owner on Apr 11, 2024. It is now read-only.

Check for actual MathML rendering #511

Open
@Oblomov

Description

@Oblomov

The HTML5 test checks that the browser correctly parses inline SVG and MathML, but does not actually verify that any attempt at actually rendering the content is made. Even if this is clearly annotated on the test, it would be appropriate to check that in addition to just parsing the tags, the user agent actually makes at least an effort at rendering.

For MathML, something like this can be used:

function hasMathMLSupport() {
        var div = document.createElement("div"), box;
        div.innerHTML = "<math><mspace height='23px' width='77px'/></math>";
        document.body.appendChild(div);
        box = div.firstChild.firstChild.getBoundingClientRect();
        document.body.removeChild(div);
        var has = Math.abs(box.height - 23) <= 1  && Math.abs(box.width - 77) <= 1;
        return has;
}

(adapted from here.)

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