我正在尝试让 mooRainbow 1.2b ( http://moorainbow.woolly-sheep.net/ ) 与 mootools 1.4.4 一起使用,但我遇到了一个我似乎无法找到答案的错误。
在本节中抛出错误...
OverlayEvents: function ()
{
var lim, curH, curW, inputs;
curH = this.snippet('curSize', 'int').h;
curW = this.snippet('curSize', 'int').w;
// $A is deprecated, the original line here was:
// inputs = $A(this.arrRGB).concat(this.arrHSB, this.hexInput);
inputs = this.arrRGB.concat(this.arrHSB, this.hexInput);
document.addEvent('click', function ()
{
if (this.visible) this.hide(this.layout);
}.bind(this));
inputs.each(function (el)
{
// this is where the error is thrown
el.addEvent('keydown', this.eventKeydown.bindWithEvent(this, el));
el.addEvent('keyup', this.eventKeyup.bindWithEvent(this, el));
}, this);
[this.element, this.layout].each(function (el)
{
el.addEvents({
'click': function (e) { new Event(e).stop(); },
'keyup': function (e)
{
e = new Event(e);
if (e.key == 'esc' && this.visible) this.hide(this.layout);
}.bind(this)
}, this);
}, this);
这是引发的错误...
Uncaught TypeError: Object function (){
if (method.$protected && this.$caller == null)
throw new Error('The method "' + key + '" cannot be called.');
var caller = this.caller, current = this.$caller;
this.caller = current; this.$caller = wrapper;
var result = method.apply(this, arguments);
this.$caller = current; this.caller = caller;
return result;
} has no method 'bindWithEvent'
PS。这个问题似乎类似于MooTools/JS: bindWithEvent但那里的答案与我的上下文无关,我不确定它是否是同一个问题。