-
-
Save darkwing/435b1c03057c62cf50fd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($) { | |
$('math').length && !hasMathMLSupport() && (function() { | |
// Add CSS fallback | |
$('<link href="/media/css/libs/mathml.css" rel="stylesheet" type="text/css" />').appendTo(document.head); | |
// Add notification | |
$('#wikiArticle').prepend('<div class="notice"><p>Your browser does not support MathML.</p></div>'); | |
}); | |
// https://github.com/Modernizr/Modernizr/blob/master/feature-detects/mathml.js | |
function hasMathMLSupport() { | |
var $div = $('<div class="offscreen"><math><mspace height="23px" width="77px"/></math></div>').appendTo(document.body); | |
var box = $div.getBoundingClientRect(); | |
$div.remove(); | |
return Math.abs(box.height - 23) && Math.abs(box.width - 77); | |
} | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment