es-shims / es5-shim

ECMAScript 5 compatibility shims for legacy (and modern) JavaScript engines
MIT License
7.12k stars 899 forks source link

JQuery ajax in ie8 with es5-shim throw TypeError #443

Closed Justinidlerz closed 7 years ago

Justinidlerz commented 7 years ago

Function.prototype.bind throw a TypeError
[Object DispHTMLWindow2] is not in isCallable function judgment types image

Justinidlerz commented 7 years ago

And the DispHTMLWindow2 function call type is [object Object]

ljharb commented 7 years ago

I'm confused, what's "DispHTMLWindow2"? window should report [object Window].

Is this normal IE 8, or is it in compatibility mode?

Also, can you show me the code that triggers this?

Justinidlerz commented 7 years ago

I'm so sorry for new this issues. The bug is not cause from es5-shim But the same code can run >= ie9, (PS: not add es5-shim). The bug cause from like this code:

var $ = require('jquery');
var getData = function(url, data, callback) {
  return $.ajax({
       url: url,
       dataType: 'jsonp',
       data: data,
       success: function(){  //... }
   })
}
getData('//test.domain.com/jsonp', {  a: 1 }, function (){ 

});
// throw error, because the data i pass a function
getData('//test.domain.com/jsonp', function(){

});