プロトタイプ フレームワークなしでこのコードを使用する場合:
if (XMLHttpRequest.prototype.sendAsBinary) return;
XMLHttpRequest.prototype.sendAsBinary = function(datastr) {
function byteValue(x) {
return x.charCodeAt(0) & 0xff;
}
console.log(Array.prototype.map);
var ords = Array.prototype.map.call(datastr, byteValue);
var ui8a = new Uint8Array(ords);
this.send(ui8a.buffer);
}
ログの戻り値:
function map() { [native code] }
プロトタイプ js フレームワークが含まれている場合、ログは次のものを返します。
function collect(iterator, context) {
iterator = iterator || Prototype.K;
var results = [];
this.each(function(value, index) {
results.push(iterator.call(context, value, index));
});
return results;
}
同時にエラーが発生しました:
Uncaught TypeError: Object [object String] has no method 'each' prototype.js:864
collect prototype.js:864
XMLHttpRequest.sendAsBinary jquery.filedrop.js:309
send jquery.filedrop.js:215
とにかくjQueryも使っています。
jQuery.noConflict();
プロトタイプ フレームワークがオンの場合、ネイティブ マップ機能を実行できないのはなぜですか?