From 62b4e68a1c5d325f663a49472295530c82fa980a Mon Sep 17 00:00:00 2001 From: Emily Eisenberg Date: Thu, 25 Jul 2013 19:15:16 -0700 Subject: [PATCH] Make safari only break on fractions Summary: Also, make errors on the initial parse not prevent further parses. Auditors: alpert --- katex.js | 8 ++++---- static/main.js | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/katex.js b/katex.js index b89efddff..f9f63efae 100644 --- a/katex.js +++ b/katex.js @@ -86,6 +86,10 @@ var buildGroup = function(style, color, group, prev) { } else if (group.type === "close") { return makeSpan("mclose" + color, [textit(group.value)]); } else if (group.type === "frac") { + if (utils.isSafari) { + throw new ParseError("KaTeX fractions don't work in Safari"); + } + var fstyle = style; if (group.value.size === "dfrac") { fstyle = Style.DISPLAY; @@ -244,10 +248,6 @@ var clearNode = function(node) { }; var process = function(toParse, baseNode) { - if (utils.isSafari) { - throw new ParseError("KaTeX doesn't work on Safari"); - } - clearNode(baseNode); var tree = parseTree(toParse); diff --git a/static/main.js b/static/main.js index 803194751..63f817928 100644 --- a/static/main.js +++ b/static/main.js @@ -2,14 +2,14 @@ window.onload = function() { var input = document.getElementById("input"); var math = document.getElementById("math"); - reprocess(); - if ("oninput" in input) { input.addEventListener("input", reprocess, false); } else { input.attachEvent("onkeyup", reprocess); } + reprocess(); + function reprocess() { katex.process(input.value, math); }