What new in jquery 3.0

What new in jquery 3.0

Deprecated

  • bind(), unbind(), delegate() and undelegate() methods
  • jQuery.parseJSON deprecated
     
  • In jQuery.ajax Removed special-case Deferred methods

Removed

  • .load(), .unload(), and .error() methods removed
  • context, support and selector properties removed
  • For '$.fn.data()' keys to be camel case
     

New Feature

  • requestAnimationFrame API used for jQuery Animations .
  • width(), .height(), .css("width"), and .css("height") return decimal value
  • .unwrap() method take any arguments
     

Removed deprecated event aliases

.load(), .unload(), and .error() methods departed from the jQuery 1.8 ,now it removed from jQuery 3.0 onward.

so dont use it with following implementation

//removed .load method from jQuery 3.0 
.load(function() {
  // other code goes here  
});
now use with following implementation load method

.on( "load", function() {
  // other code goes here
});

requestAnimationFrame API used for jQuery Animations .

jQuery will now use requestAnimationFrame API for animations , which give good smooth animation with less CPU usage and on less power consumption .

its backend change so you don t need to worry for it when you upgrading your plugin or script.


jQuery.Deferred is now Promises/A+ compatible .

jQuery.Deferred objects have been updated for compatibility with Promises/A+ and ES2015 Promises means

Legacy behavior can be restored by replacing any use of .then() with the now-deprecated .pipe()


jQuery custom selectors like :visible/:hidden. had 1600% improvement on speed

  Selectors :hidden/:visible was slow , it is improvized in the jQuery 3.0 and make it 1600% faster by using simple rule :: "Check existing selector cache and skip matchesSelector when possible "

so in jQuery 3.0 , improved performance of selector extensions when called multiple times.


:.unwrap()  method can take any arguments

  Before jQuery 3.0 , .unwrap() method simply removes the parent of selected elements, and accepts no arguments , but in some cases , its needed a way to be specific which wrappers to remove.

so now .unwrap( selector) take any argument for selective unwrapping.


width(), height(),   return decimal value

  Before jQuery 3.0 , width(), height() return rounded value. so if 3 div inside of a 100px element , width(), height() will return 33% for each div in previous version of jQuery . now it return 33.333%

this change usefull for layout calculations in UAs that do subpixel layout.



Join hands with field experts ! Partner With Us !