-// Copyright (c) 2008-2011 by Kris Maglione <maglione.k at Gmail>
+// Copyright (c) 2008-2012 Kris Maglione <maglione.k at Gmail>
//
// 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";
let { getOwnPropertyNames } = Object;
try {
-Components.utils.import("resource://dactyl/bootstrap.jsm");
defineModule("javascript", {
exports: ["JavaScript", "javascript"],
require: ["util"]
-}, this);
+});
+
+lazyRequire("template", ["template"]);
let isPrototypeOf = Object.prototype.isPrototypeOf;
context[JavaScript.EVAL_TMP] = tmp;
try {
- cache[key] = this.modules.dactyl.userEval(arg, context, /*L*/"[Command Line Completion]", 1);
+ cache[key] = this.modules.dactyl.userEval(arg, context,
+ /*L*/"[Command Line Completion]", 1);
return cache[key];
}
let [, prefix, args] = /^(function .*?)\((.*?)\)/.exec(Function.prototype.toString.call(func));
let n = this._get(i).comma.length;
args = template.map(Iterator(args.split(", ")),
- function ([i, arg]) <span highlight={i == n ? "Filter" : ""}>{arg}</span>,
- <>, </>);
- this.context.message = <>{prefix}({args})</>;
+ function ([i, arg]) ["span", { highlight: i == n ? "Filter" : "" }, arg],
+ ",\u00a0");
+ this.context.message = ["", prefix + "(", args, ")"];
}
}
}
if (!this.context.tabPressed && key == "" && obj.length > 1) {
let message = this.context.message || "";
this.context.waitingForTab = true;
- this.context.message = <>{message}
- {_("completion.waitingForKeyPress")}</>;
+ this.context.message = ["", message, "\n",
+ _("completion.waitingForKeyPress")];
return null;
}
},
addOutput: function addOutput(js) {
- default xml namespace = XHTML;
this.count++;
try {
if (e.fileName)
e = util.fixURI(e.fileName) + ":" + e.lineNumber + ": " + e;
- xml = <span highlight="ErrorMsg">{e}</span>;
+ xml = ["span", { highlight: "ErrorMsg" }, e];
}
let prompt = "js" + this.count;
Class.replaceProperty(this.context, prompt, result);
- XML.ignoreWhitespace = XML.prettyPrinting = false;
let nodes = {};
this.rootNode.appendChild(
- util.xmlToDom(<e4x>
- <div highlight="REPL-E" key="e"><span highlight="REPL-R">{prompt}></span> {js}</div>
- <div highlight="REPL-P" key="p">{xml}</div>
- </e4x>.elements(), this.document, nodes));
+ DOM.fromJSON(
+ [["div", { highlight: "REPL-E", key: "e" },
+ ["span", { highlight: "REPL-R" },
+ prompt, ">"], " ", js],
+ ["div", { highlight: "REPL-P", key: "p" },
+ xml]],
+ this.document, nodes));
this.rootNode.scrollTop += nodes.e.getBoundingClientRect().top
- this.rootNode.getBoundingClientRect().top;
count: 0,
message: Class.Memoize(function () {
- default xml namespace = XHTML;
- util.xmlToDom(<div highlight="REPL" key="rootNode"/>,
+ DOM.fromJSON(["div", { highlight: "REPL", key: "rootNode" }],
this.document, this);
return this.rootNode;
bind(["<C-b>", "<PageUp>"], "Scroll up half a page",
function ({ self }) { self.repl.scrollVertical("pages", -1); });
},
- options: function (dactyl, modules, window) {
+ options: function initOptions(dactyl, modules, window) {
modules.options.add(["jsdebugger", "jsd"],
"Enable the JavaScript debugger service for use in JavaScript completion",
"boolean", false, {