aurelia / http-client

A simple, restful, message-based wrapper around XMLHttpRequest.
MIT License
62 stars 59 forks source link

Internet Explorer: trackRequestEnd throws an error #58

Closed jdanyow closed 9 years ago

jdanyow commented 9 years ago

https://github.com/aurelia/http-client/blob/master/src/http-client.js#L19

EisenbergEffect commented 9 years ago

What is the error?

jdanyow commented 9 years ago

error

zewa666 commented 9 years ago

how bout a polyfill?

(function () {
      function CustomEvent ( event, params ) {
        params = params || { bubbles: false, cancelable: false, detail: undefined };
        var evt = document.createEvent( 'CustomEvent' );
        evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );
        return evt;
      };

      CustomEvent.prototype = window.Event.prototype;
      window.CustomEvent = CustomEvent;
    })();

its taken from MDN, which seems to be currently down. https://developer.mozilla.org/de/docs/Web/API/CustomEvent

bryanrsmith commented 9 years ago

I think we need to polyfill the CustomEvent ctor in IE. I remember seeing one inlined in one of the other projects, but I'm having a hard time finding it...

EisenbergEffect commented 9 years ago

I thought we already had this polyfill in the framework...let me check.

bryanrsmith commented 9 years ago

https://github.com/aurelia/framework/blob/master/src/aurelia.js#L19-L34

EisenbergEffect commented 9 years ago

In the framework library we have this:

if (!window.CustomEvent || typeof window.CustomEvent !== 'function') {
  var CustomEvent = function(event, params) {
    var params = params || {
      bubbles: false,
      cancelable: false,
      detail: undefined
    };

    var evt = document.createEvent("CustomEvent");
    evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
    return evt;
  };

  CustomEvent.prototype = window.Event.prototype;
  window.CustomEvent = CustomEvent;
}
jdanyow commented 9 years ago

Should I be polyfilling it in aurelia-breeze for the purposes of testing?