-// Copyright (c) 2008-2013 Kris Maglione <maglione.k at Gmail>
+// Copyright (c) 2008-2014 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.
"click": function onClick(event) {
event.preventDefault();
if (this.commandAllowed) {
- if (Set.has(this.target.commands || {}, this.command))
+ if (hasOwnProperty(this.target.commands || {}, this.command))
this.target.commands[this.command].call(this.target);
else
this.target.command(this.command);
},
get commandAllowed() {
- if (Set.has(this.target.allowedCommands || {}, this.command))
+ if (hasOwnProperty(this.target.allowedCommands || {}, this.command))
return this.target.allowedCommands[this.command];
if ("commandAllowed" in this.target)
return this.target.commandAllowed(this.command);
let obj = params.eventTarget;
let events = obj[this.getAttribute("events") || "events"];
- if (Set.has(events, "input"))
+ if (hasOwnProperty(events, "input"))
events["dactyl-input"] = events["input"];
for (let [event, handler] in Iterator(events))
- node.addEventListener(event, util.wrapCallback(obj.closure(handler), true), false);
+ node.addEventListener(event, util.wrapCallback(handler.bind(obj), true), false);
}
})
},
let res = [];
let n = 0;
- for each (let i in Iterator(iter)) {
+ for (let i in Iterator(iter)) {
let val = func(i, n);
if (val == undefined)
continue;
else if (/^n_/.test(topic))
topic = topic.slice(2);
- if (help.initialized && !Set.has(help.tags, topic))
+ if (help.initialized && !hasOwnProperty(help.tags, topic))
return ["span", { highlight: type || ""}, text || token];
type = type || (/^'.*'$/.test(token) ? "HelpOpt" :
else if (/^n_/.test(topic))
topic = topic.slice(2);
- if (help.initialized && !Set.has(help.tags, topic))
+ if (help.initialized && !hasOwnProperty(help.tags, topic))
return token;
let tag = (/^'.*'$/.test(token) ? "o" :
})(), this[help ? "HelpLink" : "helpLink"]);
},
- // Fixes some strange stack rewinds on NS_ERROR_OUT_OF_MEMORY
- // exceptions that we can't catch.
- stringify: function stringify(arg) {
- if (!callable(arg))
- return String(arg);
-
- try {
- this._sandbox.arg = arg;
- return Cu.evalInSandbox("String(arg)", this._sandbox);
- }
- finally {
- this._sandbox.arg = null;
- }
- },
-
- _sandbox: Class.Memoize(() => Cu.Sandbox(Cu.getGlobalForObject(global),
- { wantXrays: false })),
-
// if "processStrings" is true, any passed strings will be surrounded by " and
// any line breaks are displayed as \n
highlight: function highlight(arg, processStrings, clip, bw) {
// some objects like window.JSON or getBrowsers()._browsers need the try/catch
try {
- let str = this.stringify(arg);
+ let str = String(arg);
if (clip)
str = util.clip(str, clip);
switch (arg == null ? "undefined" : typeof arg) {
["td", { style: style[i] || "" }, d])])];
},
- usage: function usage(iter, format = {}) {
+ usage: function usage(iter, format={}) {
let desc = format.description || (item => this.linkifyHelp(item.description));
let help = format.help || (item => item.name);
let sourceLink = (frame) => {