jenkins-bot has submitted this change and it was merged.
Change subject: Fix: Update png fallback
......................................................................
Fix: Update png fallback
In Ifdd75ce51076b098af67a96b5dcb0fc0726d2b00
I missed to update the png fallback mechanism
given the fact that SVG is now a <img element
as well and no longer a <meta tag.
Bug: T136905
Change-Id: If1b4fb11cfb50eab98f847674fdbef2cd0e43e37
---
M modules/ext.math.js
1 file changed, 3 insertions(+), 20 deletions(-)
Approvals:
Mobrovac: Looks good to me, approved
jenkins-bot: Verified
diff --git a/modules/ext.math.js b/modules/ext.math.js
index d2a79e1..912798c 100644
--- a/modules/ext.math.js
+++ b/modules/ext.math.js
@@ -1,24 +1,5 @@
( function ( $ ) {
'use strict';
- var img, url;
-
- function insertImg( png ) {
- $( '.mwe-math-fallback-image-inline,
.mwe-math-fallback-image-display' ).each( function ( ) {
- // Create a new image to use as the fallback.
- img = document.createElement( 'img' );
- url = this.style.backgroundImage.match(
/url\(\s*(['"]?)([^\1\)]*)\1\s*\)/ )[ 2 ];
- if ( png ) {
- url = url.replace( 'media/math/render/svg/',
'media/math/render/png/' );
- }
- img.setAttribute( 'src', url );
- img.setAttribute( 'class', 'tex
mwe-math-fallback-image-' + ( $( this ).hasClass(
'mwe-math-fallback-image-inline' ) ? 'inline' : 'display' ) );
- img.setAttribute( 'aria-hidden', 'true' );
- this.parentNode.insertBefore( img, this );
-
- // Hide the old SVG fallback.
- $( this ).css( 'display', 'none' );
- } );
- }
// If MathPlayer is installed we show the MathML rendering.
if ( navigator.userAgent.indexOf( 'MathPlayer' ) > -1 ) {
@@ -30,6 +11,8 @@
// We verify whether SVG as <img> is supported and otherwise use the
// 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 );
+ $( '.mwe-math-fallback-image-inline,
.mwe-math-fallback-image-display' ).each( function ( ) {
+ this.src = this.src.replace( 'media/math/render/svg/',
'media/math/render/png/' );
+ } );
}
}( jQuery ) );
--
To view, visit https://gerrit.wikimedia.org/r/292529
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: If1b4fb11cfb50eab98f847674fdbef2cd0e43e37
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Math
Gerrit-Branch: master
Gerrit-Owner: Physikerwelt <[email protected]>
Gerrit-Reviewer: Mobrovac <[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