Work around tidy by using a meta element instead of an empty span

HTML tidy will strip empty spans, so don't use one for the fallback image. We
use a meta element instead, as that does not normally render at all & doesn't
have any default styling coming with it.

Change-Id: I5bcbbc9468433e3c8722c09ce813a6f5ac741333
This commit is contained in:
Gabriel Wicke 2014-10-15 06:08:41 -07:00 committed by Physikerwelt
parent 672df7dcc8
commit 97d6f8ff89
1 changed files with 3 additions and 2 deletions

View File

@ -383,8 +383,9 @@ class MathMathML extends MathRenderer {
$this->correctSvgStyle( $this->getSvg(), $style );
if ( $class ) { $attribs['class'] = $class; }
if ( $style ) { $attribs['style'] = $style; }
// an alternative for svg might be an object with type="image/svg+xml"
return Xml::element( 'span', $this->getAttributes( 'span', $attribs , array( 'aria-hidden' => 'true' ) ) );
// Don't use an empty span, as that is going to be stripped by HTML tidy
// when enabled (which is true in production).
return Xml::element( 'meta', $this->getAttributes( 'span', $attribs , array( 'aria-hidden' => 'true' ) ) );
}