whoops, binding func wasn't propagating the return value... not so good...
whoops, binding func wasn't propagating the return value... not so good...
--- a/client/autocomplete.xml
+++ b/client/autocomplete.xml
@@ -145,27 +145,29 @@
height: 32;
float: left;
}
]]></xbl:style>
</xbl:resources>
<xbl:implementation><![CDATA[
({
type: "contact",
- getType: function() { return this.type; },
+ getType: function() {
+ return this.type;
+ },
contact: null,
getContact: function() {
return this.contact;
},
setContact: function(aContact) {
- this._contact = aContact;
+ this.contact = aContact;
console.log("setContact", this);
- this._nName.textContent = this._contact.name;
+ this._nName.textContent = this.contact.name;
var bestEmail = null;
- var emailText = this._contact.identities.map(function (identity) {
+ var emailText = this.contact.identities.map(function (identity) {
if (identity.kind == "email")
bestEmail = identity.value;
return identity.value;
}).join(", ");
this._nEmails.textContent = emailText;
if (bestEmail) {
this._nPicture.setAttribute("src",
"http://www.gravatar.com/avatar/" + hex_md5(bestEmail) +
--- a/client/index.xhtml
+++ b/client/index.xhtml
@@ -19,18 +19,25 @@
var autocompleter = document.getElementById("autocomplete");
console.log("autocompleter", autocompleter);
autocompleter.addCompleter(ContactCompleter);
console.log("contact completer registered");
var constraints = document.getElementById("constraints");
autocompleter.addActionListener(function (item) {
console.log("!!!Action Listener!!!", item);
- if (item.getType() == "contact")
- constraints.addContact(item.getContact());
+ var itemType = item.getType();
+ console.log(".type:", itemType);
+ if (itemType == "contact") {
+ console.log("..contact case");
+ var contact = item.getContact();
+ console.log("contact", contact);
+ constraints.addContact(contact);
+ console.log("added contact", contact);
+ }
else
return;
});
console.log("constrainer registered");
}
$(function() {
window.setTimeout(funkyInit, 1000);
--- a/client/xbl-src.js
+++ b/client/xbl-src.js
@@ -1446,17 +1446,17 @@ cElementXBL.prototype.addBinding = funct
// The oBinding is roughly the internal object, whereas 'this' gets to be
// the external object.
var oBinding = new cBinding;
// 3) Attach implementation
function bind(func) {
return function() {
- func.apply(oBinding, arguments);
+ return func.apply(oBinding, arguments);
};
}
for (var sMember in oBinding)
if (sMember.indexOf("xbl") != 0) {
// All functions need to be wrapped to dispatch so that they are
// calling the method on the inner object, otherwise things get
// in a mess 'this'-wise.