math.stackexchange.com - Need to update to MathJax 1.1

RESOLVED FIXED

Status

RESOLVED FIXED
8 years ago
4 years ago

People

(Reporter: brad.quinn, Unassigned)

Tracking

(Blocks: 1 bug)

Details

Attachments

(2 attachments)

(Reporter)

Description

8 years ago
User-Agent:       Mozilla/5.0 (Windows NT 5.1; rv:2.0) Gecko/20100101 Firefox/4.0
Build Identifier: Mozilla/5.0 (Windows NT 5.1; rv:2.0) Gecko/20100101 Firefox/4.0

MathJax rendered very nicely in FF 3.16

These two narrowly focused examples do not render the same in FF 4.0;

http://meta.math.stackexchange.com/questions/1528/firefox-4-and-mathjax-not
http://meta.math.stackexchange.com/questions/1845/bar-m-needs-love-in-firefox-4



Reproducible: Always

Steps to Reproduce:
1. Navigate to the sample URLS in the Details




The problem may be in MathJax, but I can't find how to file a bug against their product (http://www.mathjax.org/)

It may also be how MathJax is configured on http://math.stackexchange.com
So if I look at http://meta.math.stackexchange.com/questions/1528/firefox-4-and-mathjax-not and focus on the exact markup generated by the page for the "a" in "$a = b$" then in 3.6 it looks sort of like this:

  <span class="mi" id="MathJax-Span-17"
        style="font-family: MathJax_Math; font-style: italic;">a</span>

while in 4 it looks sort of like this:

 <span class="mi" id="MathJax-Span-16"
       style="font-family: serif,serif;">a</span>

Observe the totally different font-family!

The issues with \not and so forth likely have to do with the fact that MathJax is using relative positioning tricks to create the overlap, which means that the result depends on font metrics.  And it's styling the text with the wrong font in Firefox 4, so getting unexpected metrics.  So far no obvious Gecko bug here; the only question is why the font style the page produces is different.
Fwiw, the relevant script _seems_ to be <http://meta.math.stackexchange.com/content/js/third-party/MathJax/MathJax.js>.  I'll attach a deobfuscated-ish version in a second.
Also relevant might be http://meta.math.stackexchange.com/content/js/third-party/MathJax/extensions/tex2jax.js

But that just converts from the TeX format to jax, whatever that is; it's not handling conversion to HTML.
Created attachment 521718 [details]
File that handles the HTML output, sorta deobfuscated
I see the "serif,serif" thing coming from handleFont.

Note that this last file has all sorts of browser-sniffing nastiness in it...

And now, the fun part.  From the main MathJax file:

  isFirefox: (document.ATTRIBUTE_NODE != null && window.directories != null),

This tests false in Firefox 4; there is no window.directories (see bug 474058).  For good measure, isSafare, isMSIE, isOpera, isChrome, and isKonqueror are all also set to false.

Now back to the HTML/CSS output file, we have the browser-sniffing that only tries to use downloadable fonts if it recognizes the browser.  So the script decides that you're using a browser that can't handle downloadable fonts, and it all falls apart.

Moral of the story: if you want to know whether a browser supports downloadable fonts, test _that_ instead of testing some random unrelated window.directories thing.  ;)
Status: UNCONFIRMED → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → INVALID
Oh, and MathJax 1.1, which seems to be the current version, has this instead (see https://github.com/mathjax/MathJax/zipball/v1.1 ):

  isFirefox: (window.netscape != null && document.ATTRIBUTE_NODE != null &&
              window.opera == null),

This happens to test true.  For now.

So it sounds like StackExchange needs to upgrade.
Brad, I'm hoping you'll pass this on to the StackExchange folks.  Their inane commenting policies mean I can't comment there myself.
(Reporter)

Comment 10

8 years ago
Thanks a lot Boris.  They're usually very responsive.
Worth reopening, resummarizing, and moving to TE until StackExchange fixes itself?
Yeah, I guess.
Assignee: nobody → english-us
Status: RESOLVED → REOPENED
Component: General → English US
Ever confirmed: true
Product: Core → Tech Evangelism
QA Contact: general → english-us
Resolution: INVALID → ---
Summary: The behavior of MathJax on http://math.stackexchange.com has changed in FF 4 → math.stackexchange.com - Need to update to MathJax 1.1
(Reporter)

Comment 13

8 years ago
The StackExchange site has upgraded the version of MathJax that they're using.
Status: REOPENED → RESOLVED
Last Resolved: 8 years ago8 years ago
Resolution: --- → FIXED
Blocks: 745687
Product: Tech Evangelism → Tech Evangelism Graveyard
You need to log in before you can comment on or make changes to this bug.