Don't run in Safari
Summary: Safari has weird bugs associated with inline-table and vertical-align, so we just won't render in Safari. Auditors: alpert
This commit is contained in:
parent
79a50b3abe
commit
905fb7fb71
4
katex.js
4
katex.js
|
@ -244,6 +244,10 @@ 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);
|
||||||
|
|
||||||
|
|
13
utils.js
13
utils.js
|
@ -13,6 +13,17 @@ function slowContains(list, elem) {
|
||||||
|
|
||||||
var contains = Array.prototype.indexOf ? fastContains : slowContains;
|
var contains = Array.prototype.indexOf ? fastContains : slowContains;
|
||||||
|
|
||||||
|
function isSafari() {
|
||||||
|
var userAgent = navigator.userAgent.toLowerCase();
|
||||||
|
|
||||||
|
// Steal these regexes from jQuery migrate for browser detection
|
||||||
|
var webkit = /(webkit)[ \/]([\w.]+)/.exec(userAgent);
|
||||||
|
var chrome = /(chrome)[ \/]([\w.]+)/.exec(userAgent);
|
||||||
|
|
||||||
|
return webkit && !chrome;
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
contains: contains
|
contains: contains,
|
||||||
|
isSafari: isSafari()
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user