Skip to content
This repository has been archived by the owner on Jan 21, 2024. It is now read-only.

Drop jQuery support #35

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 0 additions & 112 deletions tracekit.js
Original file line number Diff line number Diff line change
Expand Up @@ -1064,118 +1064,6 @@ TraceKit.computeStackTrace = (function computeStackTraceWrapper() {
_helper('setInterval');
}(window));

/**
* Extended support for backtraces and global error handling for most
* asynchronous jQuery functions.
*/
(function traceKitAsyncForjQuery($) {

// quit if jQuery isn't on the page
if (!$) {
return;
}

var _oldEventAdd = $.event.add;
$.event.add = function traceKitEventAdd(elem, types, handler, data, selector) {
var _handler;

if (handler.handler) {
_handler = handler.handler;
handler.handler = function traceKitHandler() {
try {
return _handler.apply(this, arguments);
} catch (e) {
TraceKit.report(e);
throw e;
}
};
} else {
_handler = handler;
handler = function apply_handler() {
try {
return _handler.apply(this, arguments);
} catch (e) {
TraceKit.report(e);
throw e;
}
};
}

// If the handler we are attaching doesn’t have the same guid as
// the original, it will never be removed when someone tries to
// unbind the original function later. Technically as a result of
// this our guids are no longer globally unique, but whatever, that
// never hurt anybody RIGHT?!
if (_handler.guid) {
handler.guid = _handler.guid;
} else {
handler.guid = _handler.guid = $.guid++;
}

return _oldEventAdd.call(this, elem, types, handler, data, selector);
};

var _oldReady = $.fn.ready;
$.fn.ready = function traceKitjQueryReadyWrapper(fn) {
var _fn = function () {
try {
return fn.apply(this, arguments);
} catch (e) {
TraceKit.report(e);
throw e;
}
};

return _oldReady.call(this, _fn);
};

var _oldAjax = $.ajax;
$.ajax = function traceKitAjaxWrapper(s) {
if ($.isFunction(s.complete)) {
var _oldComplete = s.complete;
s.complete = function traceKitjQueryComplete() {
try {
return _oldComplete.apply(this, arguments);
} catch (e) {
TraceKit.report(e);
throw e;
}
};
}

if ($.isFunction(s.error)) {
var _oldError = s.error;
s.error = function traceKitjQueryError() {
try {
return _oldError.apply(this, arguments);
} catch (e) {
TraceKit.report(e);
throw e;
}
};
}

if ($.isFunction(s.success)) {
var _oldSuccess = s.success;
s.success = function traceKitjQuerySuccess() {
try {
return _oldSuccess.apply(this, arguments);
} catch (e) {
TraceKit.report(e);
throw e;
}
};
}

try {
return _oldAjax.call(this, s);
} catch (e) {
TraceKit.report(e);
throw e;
}
};

}(window.jQuery));

//Default options:
if (!TraceKit.remoteFetching) {
Expand Down