From 487354fdf616847df7d5f511af0b46d3f2c37456 Mon Sep 17 00:00:00 2001 From: Matt Robenolt Date: Wed, 13 Feb 2013 08:44:15 -0800 Subject: [PATCH] Drop jQuery support In my opinion, this is too opinionated for something like TraceKit. TraceKit is a great library that provides functionality for other ligher levels libs to utilize. With my recent commit of TraceKit.wrap(), that kind of paves the way for others to use it in a way to wrap anything they want. In the case for us (raven-js), I'm going to be providing a bunch of plugins to patch common libs that a user can pick and choose from. I'd rather not include source for jQuery for someone who isn't using jQuery. I hope this makes sense. If anything, document the code that was removed and include it as a separate file so it still exists, but isn't so tightly coupled. --- tracekit.js | 112 ---------------------------------------------------- 1 file changed, 112 deletions(-) diff --git a/tracekit.js b/tracekit.js index 42902f2..67c4fc2 100644 --- a/tracekit.js +++ b/tracekit.js @@ -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) {