From 4ba68eb2bfe24972b626ff85d1a4facbdab18d9c Mon Sep 17 00:00:00 2001 From: ansuz Date: Tue, 12 Apr 2016 09:52:36 +0200 Subject: [PATCH] fix leaky variable in chainpad Patch.transform declared a 'toTransform' variable without using 'var' this caused it to leak onto the window during operational transformations --- www/common/chainpad.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/common/chainpad.js b/www/common/chainpad.js index 071c595e8..ba8a4d8ca 100644 --- a/www/common/chainpad.js +++ b/www/common/chainpad.js @@ -220,7 +220,7 @@ var transform = Patch.transform = function (origToTransform, transformBy, doc, t Common.assert(origToTransform.parentHash === transformBy.parentHash); var resultOfTransformBy = apply(transformBy, doc); - toTransform = clone(origToTransform); + var toTransform = clone(origToTransform); var text = doc; for (var i = toTransform.operations.length-1; i >= 0; i--) { /* this line caused diffs to be applied against the incorrect text