Skip to content

Commit

Permalink
Relax feature-detection for <menclose>
Browse files Browse the repository at this point in the history
Discussion is still open: w3c/mathml#105
so let's only check some minimal <mrow> support.

Igalia does not plan to implement this element in Chromium for now so
making detection too strict is causing test failures.
  • Loading branch information
fred-wang committed Jan 20, 2020
1 parent d7faaa6 commit cdba9fd
Showing 1 changed file with 5 additions and 29 deletions.
34 changes: 5 additions & 29 deletions mathml/support/feature-detection.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,35 +24,11 @@ var MathMLFeatureDetection = {
},

"has_menclose": function() {
if (!this.hasOwnProperty("_has_menclose")) {
document.body.insertAdjacentHTML("beforeend", "<math>\
<mrow style='font-size: 20px !important'>\
<mrow>\
<mrow>\
<mrow>\
<mtext>A</mtext>\
</mrow>\
</mrow>\
</mrow>\
</mrow>\
<menclose notation='box' style='font-size: 20px !important'>\
<menclose notation='box'>\
<menclose notation='box'>\
<menclose notation='box'>\
<mtext>A</mtext>\
</menclose>\
</menclose>\
</menclose>\
</menclose>\
</math>");
var math = document.body.lastElementChild;
// The boxes will make menclose wider than mrow, if the former is supported.
this._has_menclose =
math.lastElementChild.getBoundingClientRect().width -
math.firstElementChild.getBoundingClientRect().width > 5;
document.body.removeChild(math);
}
return this._has_menclose;
// Just check whether <mrow> is supported because discussion on this is
// still open ( https://github.com/mathml-refresh/mathml/issues/105 )
// and it would have to behave at least like an mrow, even if it becomes
// an unknown element at the end.
return this.has_mrow();
},

"has_merror": function() {
Expand Down

0 comments on commit cdba9fd

Please sign in to comment.