From 1ec71c11c6064ceacd0d6192bf119473b6941f73 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Mon, 24 Jan 2011 05:20:34 -0500 Subject: [PATCH] Merge change from key-processing. Closes issue #303. --- common/content/commandline.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/common/content/commandline.js b/common/content/commandline.js index 3ab022e6..63d86d07 100644 --- a/common/content/commandline.js +++ b/common/content/commandline.js @@ -1224,17 +1224,19 @@ var CommandLine = Module("commandline", { }, withOutputToString: function (fn, self) { - let buffer = []; dactyl.registerObserver("echoLine", observe, true); dactyl.registerObserver("echoMultiline", observe, true); + + let output = []; function observe(str, highlight, dom) { - buffer.push(dom && !isString(str) ? util.domToString(dom) : str); + output.push(dom && !isString(str) ? dom : str); } this.savingOutput = true; dactyl.trapErrors.apply(dactyl, [fn, self].concat(Array.slice(arguments, 2))); this.savingOutput = false; - return buffer.join("\n"); + return output.map(function (elem) elem instanceof Node ? util.domToString(elem) : elem) + .join("\n"); } }, { /**