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

Replace expression closures (function expressions - named and dynamic this).

Expression closures are to be axed. See https://bugzil.la/1083458.

Leaving deprecated() and literal() calls and method shorthand syntax
conversions until after the ESR overlap.
This commit is contained in:
Doug Kearns
2015-06-06 23:12:40 +10:00
parent 07b64b3197
commit b236add69d
43 changed files with 876 additions and 520 deletions

View File

@@ -150,7 +150,7 @@ var DOM = Class("DOM", {
}
if (DOM.isJSONXML(val))
val = (function () this).bind(val);
val = (function () { return this; }).bind(val);
if (callable(val))
return this.each(function (elem, i) {
@@ -539,8 +539,10 @@ var DOM = Class("DOM", {
let encodeComponent = encodeURIComponent;
if (charset !== "UTF-8")
encodeComponent = function encodeComponent(str)
escape(converter.ConvertFromUnicode(str) + converter.Finish());
encodeComponent = function encodeComponent(str) {
return escape(converter.ConvertFromUnicode(str) +
converter.Finish());
};
let elems = [];
if (field instanceof Ci.nsIDOMHTMLInputElement && field.type == "submit")
@@ -1122,12 +1124,22 @@ var DOM = Class("DOM", {
return this;
},
code_key: Class.Memoize(function (prop) this.init()[prop]),
code_nativeKey: Class.Memoize(function (prop) this.init()[prop]),
keyTable: Class.Memoize(function (prop) this.init()[prop]),
key_code: Class.Memoize(function (prop) this.init()[prop]),
key_key: Class.Memoize(function (prop) this.init()[prop]),
pseudoKeys: new RealSet(["count", "leader", "nop", "pass"]),
code_key: Class.Memoize(function (prop) {
return this.init()[prop];
}),
code_nativeKey: Class.Memoize(function (prop) {
return this.init()[prop];
}),
keyTable: Class.Memoize(function (prop) {
return this.init()[prop];
}),
key_code: Class.Memoize(function (prop) {
return this.init()[prop];
}),
key_key: Class.Memoize(function (prop) {
return this.init()[prop];
}),
pseudoKeys: new RealSet(["count", "leader", "nop", "pass"]),
/**
* Converts a user-input string of keys into a canonical
@@ -1927,8 +1939,10 @@ var DOM = Class("DOM", {
dactyl: NS
},
namespaceNames: Class.Memoize(function ()
iter(this.namespaces).map(([k, v]) => ([v, k])).toObject())
namespaceNames: Class.Memoize(function () {
return iter(this.namespaces).map(([k, v]) => ([v, k]))
.toObject();
})
});
Object.keys(DOM.Event.types).forEach(function (event) {