readium / readium-cfi-js

BSD 3-Clause "New" or "Revised" License
44 stars 45 forks source link

Migrate from jQuery 2 (used in shared-js etc.) to v3 (used in CFI lib) #51

Open danielweck opened 8 years ago

danielweck commented 8 years ago

https://blog.jquery.com/2016/06/09/jquery-3-0-final-released/ https://jquery.com/upgrade-guide/3.0/

danielweck commented 8 years ago

https://github.com/readium/readium-cfi-js/blob/develop/package.cson#L112

danielweck commented 8 years ago

TODO: ensure that the jQuerySizes plugin works with jQuery 2.x !! https://github.com/bramstein/jsizes

See: https://github.com/readium/readium-shared-js/issues/305#issuecomment-231363196 (cc @olivierkorner )

https://github.com/readium/readium-shared-js/blob/develop/package.cson#L111 Dependency on jQuery "latest"! https://github.com/bramstein/jsizes/blob/master/package.json#L28

danielweck commented 8 years ago

Update regarding jQuerySizes (see above comment): the code works with jQuery 2.x just fine (hasn't changed since jQuery 3.x was announced), even though package.json references "latest".

nandita121189 commented 7 years ago

Any update on this ? As I need to use jquery version 3.x but it is giving error in iframe_zip_loader.js

danielweck commented 7 years ago

As per the links in this issue's original description, there are many other breaking changes in jQuery v3. We would need to assess whether any of them would introduce regression bugs in Readium, before making the decision to upgrade from v2.

As for the iframe_zip_loader.js errors, could you please provide more information? Thank you!

nandita121189 commented 7 years ago

Hi @danielweck , I was getting error on the following line in iframe_zip_loader.js

$('svg', doc).load(function(){
          console.log('SVG loaded');
});

Its failing as jquery has changed the implementation of load function. Please refer the following link for more info. https://jquery.com/upgrade-guide/3.0/#breaking-change-load-unload-and-error-removed

So when I changed my code as following my issue was resolved

$('svg', doc).on("load", function(){
           console.log('SVG loaded');
});

But I agree with your point that there may be many such other breaking changes in jQuery v3 so I am trying to use jQuery v2 only as of now.

danielweck commented 7 years ago

Thank you @nandita121189 I pre-emptively fixed the load event: https://github.com/readium/readium-js/commit/08f3e4ed85e0ea6cb5e47a9b216bfa04bf67569a

danielweck commented 6 years ago

Note: output bundle contains two versions of jQuery. v3 is needed for Rollup support etc. in CFI lib. Ultimately, we want to remove the jQuery dependency altogether. @JCCR