Skip to content
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

MathJax.HTML.Element IE create script bug? #342

Closed
UberMeatShield opened this issue Oct 23, 2012 · 4 comments

Comments

Projects
None yet
3 participants
@UberMeatShield
Copy link

commented Oct 23, 2012

In IE 7+ if you attempt to dynamically insert script tags for the parser using the HTML helper you get an invalid property access error. Perhaps I should be using something else to insert but this change will fix it. If I want to help is the preferred method to Fork and do pull requests :)?

Repo: In IE console with MathJax 2.0 or 2.1 loaded into the page.

MathJax.HTML.Element("script", {id: "Damn_IE", type: 'math/tex'}, "\displaystyle {}");
"Unexpected call to method or property access.

--- a/unpacked/MathJax.js
+++ b/unpacked/MathJax.js
@@ -971,7 +971,11 @@ MathJax.HTML = {
         if (contents[i] instanceof Array) {
           obj.appendChild(this.Element(contents[i][0],contents[i][1],contents[i][2]));
         } else {
-          obj.appendChild(document.createTextNode(contents[i]));
+          if (type != "script") { //In IE appending a text node breaks..
+            obj.appendChild(document.createTextNode(contents[i]));
+          } else {
+            this.setScript(obj, contents[i]);
+          }
         }
       }
     }

With that fix a call to: MathJax.Hub.Queue(["Typeset", MathJax.Hub, "Damn_IE"]); will then properly parse the script node.

@dpvc

This comment has been minimized.

Copy link
Member

commented Nov 1, 2012

Thanks for the update. I will include it in the next update.

@ghost ghost assigned dpvc Apr 16, 2013

dpvc pushed a commit to dpvc/MathJax that referenced this issue Apr 17, 2013

@dpvc

This comment has been minimized.

Copy link
Member

commented Apr 17, 2013

The issue342 branch of my fork of MathJax includes the fix.

@fred-wang

This comment has been minimized.

Copy link
Contributor

commented Apr 19, 2013

I'll add a test

API/HTML/Element-2.html

(essentially like Element-1 but creating a script)

I haven't the fix on IE, but let's merge it and see if the test passes.

=> In testsuite, Ready For release

dpvc pushed a commit to dpvc/MathJax that referenced this issue Apr 19, 2013

@dpvc

This comment has been minimized.

Copy link
Member

commented Apr 19, 2013

=> Merged

@dpvc dpvc closed this May 17, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.