mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-06 03:38:39 +00:00
Fix exponential behavior in accent production (#834)
src/functions.js was returning two properties referring to the base; since buildHTML runs `JSON.parse(JSON.stringify(tree))` to get an immutable copy, that meant we'd traverse and serialize and parse an exponentially-sized tree. Test Plan: `\breve{\breve{\breve{\breve{\breve{\breve{\breve{\breve{\breve{\breve{\breve{\breve{\breve{\breve{\breve{\breve{\breve{\breve{\breve{\breve{\breve{\breve{\breve{\breve{\breve{\breve{\breve{\breve{\breve{\breve{\breve{\breve{\breve{\breve{A}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}` renders instantly; previously, it reliably timed out with even half that depth.
This commit is contained in:
committed by
Kevin Barabash
parent
d36ca4a2fa
commit
b27d7011d1
@@ -656,7 +656,6 @@ defineFunction([
|
||||
label: context.funcName,
|
||||
isStretchy: isStretchy,
|
||||
isShifty: isShifty,
|
||||
value: ordargument(base),
|
||||
base: base,
|
||||
};
|
||||
});
|
||||
@@ -677,7 +676,6 @@ defineFunction([
|
||||
label: context.funcName,
|
||||
isStretchy: false,
|
||||
isShifty: true,
|
||||
value: ordargument(base),
|
||||
base: base,
|
||||
};
|
||||
});
|
||||
@@ -704,12 +702,11 @@ defineFunction([
|
||||
], {
|
||||
numArgs: 1,
|
||||
}, function(context, args) {
|
||||
const body = args[0];
|
||||
const base = args[0];
|
||||
return {
|
||||
type: "accentUnder",
|
||||
label: context.funcName,
|
||||
value: ordargument(body),
|
||||
body: body,
|
||||
base: base,
|
||||
};
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user