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

Check for actual MathML rendering #511

Open
Oblomov opened this issue Aug 11, 2017 · 1 comment
Open

Check for actual MathML rendering #511

Oblomov opened this issue Aug 11, 2017 · 1 comment

Comments

@Oblomov
Copy link
Contributor

Oblomov commented Aug 11, 2017

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.)

@Oblomov
Copy link
Contributor Author

Oblomov commented Aug 12, 2017

A tentative patch implementing this is in PR #513

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant