]> git.donarmstrong.com Git - dactyl.git/blobdiff - common/content/modes.js
Import r6923 from upstream hg supporting Firefox up to 22.0a1
[dactyl.git] / common / content / modes.js
index 127fa95a9f89b716c4e735c556e1bc9215408813..2df79d9c3811ebf295186b72dfaaacf44a569d79 100644 (file)
@@ -1,10 +1,10 @@
 // Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
 // Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
-// Copyright (c) 2008-2011 by Kris Maglione <maglione.k@gmail.com>
+// Copyright (c) 2008-2012 Kris Maglione <maglione.k@gmail.com>
 //
 // 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";
 
 /** @scope modules */
 
@@ -119,7 +119,11 @@ var Modes = Module("modes", {
             onKeyPress: function (events) { if (modes.main == modes.QUOTE) modes.pop(); }
         });
         this.addMode("IGNORE", { hidden: true }, {
-            onKeyPress: function (events) false,
+            onKeyPress: function (events_) {
+                if (events.isCancelKey(DOM.Event.stringify(events_[0])))
+                    return true;
+                return false;
+            },
             bases: [],
             passthrough: true
         });
@@ -487,7 +491,9 @@ var Modes = Module("modes", {
         update(StackElement.prototype, {
             get toStringParams() !loaded.modes ? this.main.name : [
                 this.main.name,
-                <>({ modes.all.filter(function (m) this.extended & m, this).map(function (m) m.name).join("|") })</>
+                ["(", modes.all.filter(function (m) this.extended & m, this)
+                           .map(function (m) m.name).join("|"),
+                 ")"].join("")
             ]
         });
         return StackElement;
@@ -530,23 +536,23 @@ var Modes = Module("modes", {
                 for (let base in values(mode.bases))
                     tree[base.name][mode.name] = tree[mode.name];
 
-            let roots = iter([m.name, tree[m.name]] for (m in values(list)) if (!m.bases.length)).toObject();
+            let roots = iter([m.name, tree[m.name]]
+                             for (m in values(list))
+                             if (!m.bases.length)).toObject();
 
-            default xml namespace = NS;
             function rec(obj) {
-                XML.ignoreWhitespace = XML.prettyPrinting = false;
-
-                let res = <ul dactyl:highlight="Dense" xmlns:dactyl={NS}/>;
+                let res = ["ul", { "dactyl:highlight": "Dense" }];
                 Object.keys(obj).sort().forEach(function (name) {
                     let mode = modes.getMode(name);
-                    res.* += <li><em>{mode.displayName}</em>: {mode.description}{
-                        rec(obj[name])
-                    }</li>;
+                    res.push(["li", {},
+                                ["em", {}, mode.displayName],
+                                ": ", mode.description,
+                                rec(obj[name])]);
                 });
 
-                if (res.*.length())
+                if (res.length > 2)
                     return res;
-                return <></>;
+                return [];
             }
 
             return rec(roots);