Make safari only break on fractions
Summary: Also, make errors on the initial parse not prevent further parses. Auditors: alpert
This commit is contained in:
parent
905fb7fb71
commit
62b4e68a1c
8
katex.js
8
katex.js
|
@ -86,6 +86,10 @@ var buildGroup = function(style, color, group, prev) {
|
||||||
} else if (group.type === "close") {
|
} else if (group.type === "close") {
|
||||||
return makeSpan("mclose" + color, [textit(group.value)]);
|
return makeSpan("mclose" + color, [textit(group.value)]);
|
||||||
} else if (group.type === "frac") {
|
} else if (group.type === "frac") {
|
||||||
|
if (utils.isSafari) {
|
||||||
|
throw new ParseError("KaTeX fractions don't work in Safari");
|
||||||
|
}
|
||||||
|
|
||||||
var fstyle = style;
|
var fstyle = style;
|
||||||
if (group.value.size === "dfrac") {
|
if (group.value.size === "dfrac") {
|
||||||
fstyle = Style.DISPLAY;
|
fstyle = Style.DISPLAY;
|
||||||
|
@ -244,10 +248,6 @@ var clearNode = function(node) {
|
||||||
};
|
};
|
||||||
|
|
||||||
var process = function(toParse, baseNode) {
|
var process = function(toParse, baseNode) {
|
||||||
if (utils.isSafari) {
|
|
||||||
throw new ParseError("KaTeX doesn't work on Safari");
|
|
||||||
}
|
|
||||||
|
|
||||||
clearNode(baseNode);
|
clearNode(baseNode);
|
||||||
var tree = parseTree(toParse);
|
var tree = parseTree(toParse);
|
||||||
|
|
||||||
|
|
|
@ -2,14 +2,14 @@ window.onload = function() {
|
||||||
var input = document.getElementById("input");
|
var input = document.getElementById("input");
|
||||||
var math = document.getElementById("math");
|
var math = document.getElementById("math");
|
||||||
|
|
||||||
reprocess();
|
|
||||||
|
|
||||||
if ("oninput" in input) {
|
if ("oninput" in input) {
|
||||||
input.addEventListener("input", reprocess, false);
|
input.addEventListener("input", reprocess, false);
|
||||||
} else {
|
} else {
|
||||||
input.attachEvent("onkeyup", reprocess);
|
input.attachEvent("onkeyup", reprocess);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reprocess();
|
||||||
|
|
||||||
function reprocess() {
|
function reprocess() {
|
||||||
katex.process(input.value, math);
|
katex.process(input.value, math);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user