Patching CDN hosted jQuery

Today I encountered my first bug in the latest release of  jQuery, the 1.5 version.

After upgrading to this version, the drag and drop functionality (implemented with the jQuery UI Draggable interaction component)  of a project I am working on started to exhibit strange behaviors.  After some bug hunting I found that the problem was caused by this bug.

The fix is already on GitHub and will be released with the 1.5.1 milestone.

Meanwhile, because I am using the library file hosted on the CDNs, I patched it overriding the offending function like this:

<script src="http://code.jquery.com/jquery-1.5.js"></script>
<script>
   jQuery.fn.clone = function( dataAndEvents, deepDataAndEvents ) {
      dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
      deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;

      return this.map( function () {
         return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
      });
  };
</script>
Advertisements

Published by

mgiulio

Front End Developer

One thought on “Patching CDN hosted jQuery”

  1. We have decided to open our POWERFUL and PRIVATE web traffic system to the public for a limited time! You can sign up for our UP SCALE network with a free trial as we get started with the public’s orders. Imagine how your bank account will look when your website gets the traffic it deserves. Visit us today: http://voxseo.com/traffic/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s