Cookies op Tweakers

Tweakers maakt gebruik van cookies, onder andere om de website te analyseren, het gebruiksgemak te vergroten en advertenties te tonen. Door gebruik te maken van deze website, of door op 'Ga verder' te klikken, geef je toestemming voor het gebruik van cookies. Wil je meer informatie over cookies en hoe ze worden gebruikt, bekijk dan ons cookiebeleid.

Meer informatie

Door , , 2 reacties
Bron: Fabrikant, submitter: Jogai

jQuery logo (75 pix)Voor het vereenvoudigen van client-side-scripting in html kun je gebruikmaken van jQuery. Dit is een opensource-JavaScript-library, waarvan de syntax het makkelijker maakt om door documenten te navigeren, DOM-elementen te selecteren, animaties in elkaar te zetten, events af te handelen en natuurlijk Ajax-applicaties te ontwikkelen. Daarnaast kan de functionaliteit worden uitgebreid door plug-ins te gebruiken. Voor meer informatie verwijzen we naar deze pagina. Bij deze versie 3.1.0 zijn fixes doorgevoerd die een einde moeten maken aan silent errors.

jQuery 3.1.0 Released – No More Silent Errors

Not so long ago, we released jQuery 3.0. One of the major features of jQuery 3.0 was a small rewrite of jQuery Deferreds. Specifically, we made them compatible with the Promises/A+ spec. That basically meant that errors had to be silenced and passed as rejection values to rejection handlers (added using deferred.catch()). This had the advantage of preventing Promise handlers from getting blocked up by runtime errors, but the disadvantage of errors being silenced if no rejection handlers were added. While this was the right move for Deferreds, we had also changed jQuery.ready and jQuery.fn.ready to use the new spec-compliant Deferreds under the covers.

Unfortunately, if you were using the usual ways to attach ready handlers (e.g. jQuery(function() {}) and jQuery(document).ready(function() {})), you had no way to add a rejection handler. Plus, it wasn’t obvious that you were in Deferred land. Any runtime exceptions were getting swallowed and lost in space. I think they ended up somewhere near Pluto, which isn’t even a planet anymore! There were workarounds, but this wasn’t acceptable to us.

We immediately set out to fix this, and thus jQuery 3.1.0 was born. No longer will errors be silent! You will see them logged to the console by default. If you’d like to have more control on how these errors are handled, we also added an entry point: jQuery.readyException. In most cases, you won’t need to use it, but any errors that are thrown within a ready handler will get passed to this function should you need it.

jQuery.readyException = function(error) {
  // "error" is thrown from any ready handler
};

The default jQuery.readyException will re-throw the error asynchronously, to avoid stopping execution and log the error to the console. We hope this solves any debugging issues you may have experienced when using jQuery 3.0.

We do not expect this release to have any breaking changes, but if you do encounter bugs in upgrading from the previous version, please let us know.

If you’d like help upgrading from jQuery 1.x or 2.x to jQuery 3.0, please check out the 3.0 Upgrade Guide and the jQuery Migrate 1.4.1 blog post.

3.1.0GitHub changelog

jQuery logo

Versienummer:3.1.0
Releasestatus:Final
Website:Fabrikant
Download:https://jquery.com/download/
Licentietype:GPL
Moderatie-faq Wijzig weergave

Reacties (2)

Welke websitebouwer kan eigenlijk zonder dit fraaie werk?

Op dit item kan niet meer gereageerd worden.



Nintendo Switch Google Pixel Sony PlayStation VR Samsung Galaxy S8 Apple iPhone 7 Dishonored 2 Google Android 7.x Watch_Dogs 2

© 1998 - 2016 de Persgroep Online Services B.V. Tweakers vormt samen met o.a. Autotrack en Carsom.nl de Persgroep Online Services B.V. Hosting door True