以下は、「this」をjavascriptのクリックイベントにバインドすることで発生するエラーです。jsの形式はJaml/Moomlであり、一部の人にはなじみがないかもしれませんが、構文が適切であることを保証します。私は同じ方法で多くのイベントに「これ」をバインドしてきましたが、このエラーを目にしたのはこれが初めてなので、mootools、jaml、またはjavascriptの専門家が以下のエラーとコードから解決策を導き出すことができることを願っています。
Uncaught TypeError: Object [object Object] has no method 'get'
Mooml.engine.tags.div.Mooml.engine.tags.div.events.click:relay(a)
bubbleUpmootools-core-1.4.1.js:3948
delegation.addEvent.delegatormootools-core-1.4.1.js:4078
defn
これがJamlです...
'main': new Mooml.Template(null, function(data) {
div({'class': 'lists container'},
div({
'class': 'sources',
'events': {
'click:relay(a)': function(event) {
event.preventDefault();
new Resource({
'url': this.get('href'),
'method': 'FRIENDS',
'query' : {
'source': this.dataset.source
},
'onSuccess': function(response) {
console.log(response);
//this.renderTemplate('friends', response.mv, this);
}.bind(this),
'onFailure': this.onFailure
}).send();
}.bind(this)
}