1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-29 15:35:46 +01:00

Death to E4X and stuff.

This commit is contained in:
Kris Maglione
2012-12-16 19:58:35 -08:00
parent 1aaf3f75aa
commit 2f0af0a3f1
5 changed files with 13 additions and 132 deletions

View File

@@ -4,7 +4,7 @@
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
/* use strict */
"use strict";
var MOW = Module("mow", {
init: function init() {
@@ -104,12 +104,6 @@ var MOW = Module("mow", {
this.messages = [];
}
// If it's already XML, assume it knows what it's doing.
// Otherwise, white space is significant.
// The problem elsewhere is that E4X tends to insert new lines
// after interpolated data.
XML.ignoreWhitespace = XML.prettyPrinting = false;
highlightGroup = "CommandOutput " + (highlightGroup || "");
if (isObject(data) && !isinstance(data, _) && !DOM.isJSONXML(data)) {
@@ -127,19 +121,13 @@ var MOW = Module("mow", {
}
this.messages.push(data);
}
else if (DOM.isJSONXML(data) || isString(data)) {
else {
let style = isString(data) ? "pre-wrap" : "nowrap";
this.lastOutput = ["div", { style: "white-space: " + style, highlight: highlightGroup },
data];
var output = DOM(this.lastOutput, this.document);
}
else {
let style = isString(data) ? "pre-wrap" : "nowrap";
this.lastOutput = <div style="white-space: nowrap" highlight={highlightGroup}>{data}</div>;
var output = DOM(this.lastOutput, this.document);
}
// FIXME: need to make sure an open MOW is closed when commands
// that don't generate output are executed