Skip to content

Loading MathJax in IE causes javascript error if the document contains 30 or more stylesheets #60

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kylecgit opened this issue Jan 25, 2011 · 5 comments
Labels
Accepted Issue has been reproduced by MathJax team Browser Bug Test Available

Comments

@kylecgit
Copy link

Platform: Win7 IE8

Create a sample file in the test directory, containing 30 (or more) style tags, like the following:

<html>
<head>
<style type="text/css"></style>
<style type="text/css"></style>
<style type="text/css"></style>
<style type="text/css"></style>
<style type="text/css"></style>
<style type="text/css"></style>
<style type="text/css"></style>
<style type="text/css"></style>
<style type="text/css"></style>
<style type="text/css"></style>
<style type="text/css"></style>
<style type="text/css"></style>
<style type="text/css"></style>
<style type="text/css"></style>
<style type="text/css"></style>
<style type="text/css"></style>
<style type="text/css"></style>
<style type="text/css"></style>
<style type="text/css"></style>
<style type="text/css"></style>
<style type="text/css"></style>
<style type="text/css"></style>
<style type="text/css"></style>
<style type="text/css"></style>
<style type="text/css"></style>
<style type="text/css"></style>
<style type="text/css"></style>
<style type="text/css"></style>
<style type="text/css"></style>
<style type="text/css"></style>
</head>
<body>

<script src='../MathJax.js'>MathJax.Hub.Config({ extensions: ['mml2jax.js'], jax: ['input/MathML','output/HTML-CSS']});</script>

<math>
</math>

</body>
</html>

Load this file in internet explorer. Javascript error will occur on the line containing the code 'i.styleSheet.cssText=h', because i.styleSheet's disabled property is set to true once it is inserted into the document.

@dpvc
Copy link
Member

dpvc commented Jan 25, 2011

IE has a hard limit of 31 stylesheets on the page (see this support posting for more), and since MathJax inserts some new style sheets, if your page starts out with (or loads) many style sheets, this limit can be exceeded. In your case, with only 1 style sheet left unused, you are pretty much guaranteed to cause MathJax to fail.

I consider this a bug in IE rather than MathJax, but it's also true that MathJax could check to see if the limits is going to be exceeded and give a message and fail more gracefully. Currently, MathJax doesn't try too hard to conserve style sheets, so there is also some optimization that could be done there to help reduce the number of stylesheets that MathJax uses. That is something that we should look into doing.

The limitation to 31 sheets is the real source of the problem, however.

Davide

@fred-wang
Copy link
Contributor

I've added reftest MathMLToDisplay/MSIE-stylesheets.html for this issue.

@pkra
Copy link
Contributor

pkra commented Aug 20, 2014

FWIW, this has been fixed in IE10+

@pkra
Copy link
Contributor

pkra commented Apr 15, 2015

Can we close this?

@dpvc
Copy link
Member

dpvc commented Apr 15, 2015

Sure.

@dpvc dpvc closed this as completed Apr 15, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accepted Issue has been reproduced by MathJax team Browser Bug Test Available
Projects
None yet
Development

No branches or pull requests

4 participants