mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-11-23 23:25:02 +00:00
Use img instead of meta tags for SVGs
* replace meta tag with img tag * remove js workaround for IE Bug: T136709 Change-Id: Ifdd75ce51076b098af67a96b5dcb0fc0726d2b00
This commit is contained in:
parent
76fcd6e42c
commit
349d7cfc16
|
@ -385,9 +385,9 @@ class MathMathML extends MathRenderer {
|
|||
* @return string XML the image html tag
|
||||
*/
|
||||
private function getFallbackImage( $noRender = false, $classOverride = false ) {
|
||||
$url = $this->getFallbackImageUrl( $noRender );
|
||||
|
||||
$attribs = [];
|
||||
$attribs = [
|
||||
'src' => $this->getFallbackImageUrl( $noRender )
|
||||
];
|
||||
if ( $classOverride === false ) { // $class = '' suppresses class attribute
|
||||
$class = $this->getClassName( true );
|
||||
} else {
|
||||
|
@ -396,18 +396,13 @@ class MathMathML extends MathRenderer {
|
|||
if ( ! $this->mathoidStyle ) {
|
||||
$this->correctSvgStyle( $this->mathoidStyle );
|
||||
}
|
||||
// TODO: move the common styles to the global stylesheet!
|
||||
$style = 'background-image: url(\''. $url .
|
||||
'\'); background-repeat: no-repeat; background-size: 100% 100%; '.
|
||||
$this->mathoidStyle;
|
||||
if ( $class ) {
|
||||
$attribs['class'] = $class;
|
||||
}
|
||||
|
||||
// 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, [ 'aria-hidden' => 'true', 'style' => $style
|
||||
return Xml::element( 'img', $this->getAttributes( 'span', $attribs, [
|
||||
'aria-hidden' => 'true',
|
||||
'style' => $this->mathoidStyle
|
||||
] ) );
|
||||
}
|
||||
|
||||
|
|
|
@ -31,8 +31,5 @@
|
|||
// PNG fallback. See https://github.com/Modernizr/Modernizr/blob/master/feature-detects/svg/asimg.js
|
||||
if ( !document.implementation.hasFeature( 'http://www.w3.org/TR/SVG11/feature#Image', '1.1' ) ) {
|
||||
insertImg( true );
|
||||
} else if ( $.client.profile().name.match( /msie|edge/ ) ) {
|
||||
// For all IE versions the meta tags are rendered blurry, while img tags are rendered fine.
|
||||
insertImg( false );
|
||||
}
|
||||
}( jQuery ) );
|
||||
|
|
Loading…
Reference in a new issue