From 3875af87636dd3e3a9e4e16ca132f1157e97b50e Mon Sep 17 00:00:00 2001 From: John Resig Date: Thu, 30 Apr 2015 12:51:43 -0400 Subject: [PATCH] buildHTML's buildExpression is destructive, changing the tree object, this clones the object first before manipulating it. --- src/buildHTML.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/buildHTML.js b/src/buildHTML.js index 94eead23c..c3cc4e970 100644 --- a/src/buildHTML.js +++ b/src/buildHTML.js @@ -1157,6 +1157,10 @@ var buildGroup = function(group, options, prev) { * nodes. */ var buildHTML = function(tree, settings) { + // buildExpression is destructive, so we need to make a clone + // of the incoming tree so that it isn't accidentally changed + tree = JSON.parse(JSON.stringify(tree)); + var startStyle = Style.TEXT; if (settings.displayMode) { startStyle = Style.DISPLAY;