jenkins-bot has submitted this change and it was merged.
Change subject: Use img instead of meta tags for SVGs
......................................................................
Use img instead of meta tags for SVGs
* replace meta tag with img tag
* remove js workaround for IE
Bug: T136709
Change-Id: Ifdd75ce51076b098af67a96b5dcb0fc0726d2b00
---
M MathMathML.php
M modules/ext.math.js
2 files changed, 6 insertions(+), 14 deletions(-)
Approvals:
Thcipriani: Looks good to me, approved
jenkins-bot: Verified
diff --git a/MathMathML.php b/MathMathML.php
index 09722bd..26ee1b3 100644
--- a/MathMathML.php
+++ b/MathMathML.php
@@ -385,9 +385,9 @@
* @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 @@
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
] ) );
}
diff --git a/modules/ext.math.js b/modules/ext.math.js
index b3fe744..d2a79e1 100644
--- a/modules/ext.math.js
+++ b/modules/ext.math.js
@@ -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 ) );
--
To view, visit https://gerrit.wikimedia.org/r/292344
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ifdd75ce51076b098af67a96b5dcb0fc0726d2b00
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Math
Gerrit-Branch: wmf/1.28.0-wmf.4
Gerrit-Owner: Mobrovac <[email protected]>
Gerrit-Reviewer: Physikerwelt <[email protected]>
Gerrit-Reviewer: Thcipriani <[email protected]>
Gerrit-Reviewer: TheDJ <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits