Use spans for displaystyle fallback images

Previously, we were using div containers to SVG fallback images to
mimic the MathML  behaviour. This had unintended side
effects as reported in T182041.

This change uses span containers for both display and inline math
fallback images.

Bug: T182041
Change-Id: I1d563f9f3cba8a10af2665518be6c672de174333
This commit is contained in:
Moritz Schubotz (physikerwelt) 2024-06-08 13:31:30 +02:00
parent 008db7ad08
commit b86ab8b4fa
No known key found for this signature in database
GPG key ID: F803DB146DDF36C3

View file

@ -457,10 +457,8 @@ class MathMathML extends MathRenderer {
$config = MediaWikiServices::getInstance()->getMainConfig(); $config = MediaWikiServices::getInstance()->getMainConfig();
$enableLinks = $config->get( "MathEnableFormulaLinks" ); $enableLinks = $config->get( "MathEnableFormulaLinks" );
if ( $this->getMathStyle() === 'display' ) { if ( $this->getMathStyle() === 'display' ) {
$element = 'div';
$mml_class = 'mwe-math-mathml-display'; $mml_class = 'mwe-math-mathml-display';
} else { } else {
$element = 'span';
$mml_class = 'mwe-math-mathml-inline'; $mml_class = 'mwe-math-mathml-inline';
} }
$attribs = [ 'class' => 'mwe-math-element' ]; $attribs = [ 'class' => 'mwe-math-element' ];
@ -494,7 +492,7 @@ class MathMathML extends MathRenderer {
'class' => $mml_class, 'class' => $mml_class,
]; ];
} }
$output .= Html::rawElement( $element, $mml_attribs, $mml ); $output .= Html::rawElement( 'span', $mml_attribs, $mml );
if ( $svg ) { if ( $svg ) {
$output .= $this->getFallbackImage(); $output .= $this->getFallbackImage();
} }
@ -506,7 +504,7 @@ class MathMathML extends MathRenderer {
); );
} }
return Html::rawElement( $element, $attribs, $output ); return Html::rawElement( 'span', $attribs, $output );
} }
protected function dbOutArray() { protected function dbOutArray() {