Revert "Make KaTeX work in Quirks mode (#608)" (#777)

This reverts commit d93a958379.
This commit is contained in:
Kevin Barabash
2017-07-30 23:28:58 -04:00
committed by GitHub
parent d93a958379
commit 1e148746f8
8 changed files with 40 additions and 84 deletions

View File

@@ -18,7 +18,7 @@ import utils from "./src/utils";
* Parse and build an expression, and place that expression in the DOM node
* given.
*/
const render = function(expression, baseNode, options) {
let render = function(expression, baseNode, options) {
utils.clearNode(baseNode);
const settings = new Settings(options);
@@ -29,6 +29,20 @@ const render = function(expression, baseNode, options) {
baseNode.appendChild(node);
};
// KaTeX's styles don't work properly in quirks mode. Print out an error, and
// disable rendering.
if (typeof document !== "undefined") {
if (document.compatMode !== "CSS1Compat") {
typeof console !== "undefined" && console.warn(
"Warning: KaTeX doesn't work in quirks mode. Make sure your " +
"website has a suitable doctype.");
render = function() {
throw new ParseError("KaTeX doesn't work in quirks mode.");
};
}
}
/**
* Parse and build an expression, and return the markup for that.
*/