エースエディターとムーツールを使用しています。mootools をバージョン 1.4.5 に更新したところ、エディターをクリック/ドラッグすると、js 例外が発生します。
Uncaught TypeError: Cannot read property 'clientX' of undefined
助けてください...ありがとう
エースエディターとムーツールを使用しています。mootools をバージョン 1.4.5 に更新したところ、エディターをクリック/ドラッグすると、js 例外が発生します。
Uncaught TypeError: Cannot read property 'clientX' of undefined
助けてください...ありがとう
bind メソッドを常に削除する代わりに、回避策を見つけたと思います。この問題が発生する Mootools ビルドはごくわずかのようです。したがって、このコードを使用してそれらを修正します。
if (this.MooTools.build=='ab8ea8824dc3b24b6666867a2c4ed58ebb762cf0') {
delete Function.prototype.bind;
Function.implement({
/*<!ES5-bind>*/
bind: function(that){
var self = this,
args = arguments.length > 1 ? Array.slice(arguments, 1) : null,
F = function(){};
var bound = function(){
var context = that, length = arguments.length;
if (this instanceof bound){
F.prototype = self.prototype;
context = new F;
}
var result = (!args && !length)
? self.call(context)
: self.apply(context, args && length ? args.concat(Array.slice(arguments)) : args || arguments);
return context == that ? result : context;
};
return bound;
},
/*</!ES5-bind>*/
});
}
利点は、ビルドごとに個別に修正できることです。欠点は明らかに、mootools コードを自分のコードに同梱することです。しかし、現在、他に選択肢はありません。Joomla のコードを書いているので、使用されている mootools のバージョンは限られていると確信しています。
私は自分の状況のためにそれを解決します!mootools.jsからいくつかの行を削除しました:
1)bind:function(e){var a = this、b = arguments.length> 1?Array.slice(arguments、1):null、d = function(){}; var c = function(){var g = e、h = arguments.length; if(this instanceof c){d.prototype = a.prototype; g = new d;} var f =(!b &&!h)?a.call(g):a.apply(g、b && h?b.concat(Array.slice(arguments)):b || arguments); return g == e?f:g;}; return c;}
2)Function.prototype.bindを削除します。
(私はmootoolsでマウスバインディングを必要としないので、それは私にとっての啓示です!)
これは非常に奇妙なエラーです。デバッグ中にエラーが発生しませんでした。しかし、ブレークポイントを削除するとすぐに再び表示されました。mootools 1.4.5 の最新バージョンを joomla に追加することで、最終的に問題を解決しました。エラーはすぐになくなりました。