mathml.js 945 B

123456789101112131415161718192021222324252627282930313233
  1. /*!
  2. {
  3. "name": "MathML",
  4. "property": "mathml",
  5. "caniuse": "mathml",
  6. "authors": ["Addy Osmani", "Davide P. Cervone", "David Carlisle"],
  7. "knownBugs": ["Firefox < 4 will likely return a false, however it does support MathML inside XHTML documents"],
  8. "notes": [{
  9. "name": "W3C Spec",
  10. "href": "https://www.w3.org/Math/"
  11. }],
  12. "polyfills": ["mathjax"]
  13. }
  14. !*/
  15. /* DOC
  16. Detects support for MathML, for mathematic equations in web pages.
  17. */
  18. define(['Modernizr', 'testStyles'], function(Modernizr, testStyles) {
  19. // Based on work by Davide (@dpvc) and David (@davidcarlisle)
  20. // in https://github.com/mathjax/MathJax/issues/182
  21. Modernizr.addTest('mathml', function() {
  22. var ret;
  23. testStyles('#modernizr{position:absolute;display:inline-block}', function(node) {
  24. node.innerHTML += '<math><mfrac><mi>xx</mi><mi>yy</mi></mfrac></math>';
  25. ret = node.offsetHeight > node.offsetWidth;
  26. });
  27. return ret;
  28. });
  29. });