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

Fixes, mostly, most of which should really be in the default branch.

--HG--
branch : groups
This commit is contained in:
Kris Maglione
2011-02-09 07:21:10 -05:00
parent 8acf2c4ff0
commit 7aed800d29
8 changed files with 55 additions and 29 deletions

View File

@@ -6,7 +6,7 @@
Components.utils.import("resource://dactyl/bootstrap.jsm");
defineModule("template", {
exports: ["Template", "template"],
exports: ["Binding", "Template", "template"],
require: ["util"],
use: ["services"]
}, this);
@@ -14,8 +14,9 @@ defineModule("template", {
default xml namespace = XHTML;
var Binding = Class("Binding", {
init: function (node) {
init: function (node, nodes) {
this.node = node;
this.nodes = nodes;
node.dactylBinding = this;
Object.defineProperties(node, this.constructor.properties);
@@ -32,9 +33,13 @@ var Binding = Class("Binding", {
},
get collapsed() !!this.getAttribute("collapsed"),
__noSuchMethod__: function __noSuchMethod__(meth, args) {
return this.node[meth].apply(this.node, args);
}
__noSuchMethod__: Class.Property({
configurable: true,
writeable: true,
value: function __noSuchMethod__(meth, args) {
return this.node[meth].apply(this.node, args);
}
})
}, {
get bindings() {
let bindingProto = Object.getPrototypeOf(Binding.prototype);
@@ -66,10 +71,12 @@ var Binding = Class("Binding", {
for (let obj in this.bindings)
for (let prop in properties(obj)) {
let desc = Object.getOwnPropertyDescriptor(obj, prop);
for (let k in values(["get", "set", "value"]))
if (typeof desc[k] === "function")
desc[k] = this.bind(desc[k]);
res[prop] = desc;
if (desc.enumerable) {
for (let k in values(["get", "set", "value"]))
if (typeof desc[k] === "function")
desc[k] = this.bind(desc[k]);
res[prop] = desc;
}
}
return res;
})