Tech blog to share information.

May 5, 2018

Jquery3 : How to Migrate to Jquery3

May 05, 2018 Posted by tj cool , , , No comments

In Software Development Migration is never easy. Be it data migration or migrating from one technology to another, Migration is full of surprises. Jquery is one of those frameworks, where front-end developer relies most upon. In Recent times Jquery has come up with new exciting features. Same is the case with the latest version of Jquery i.e. Jquery3.

Latest Jquery3 has come up with major changes and so it has a considerable impact on plugins, code that is developed on an older version of Jquery.

Usually, when we upgrade to newer Jquery subversions, it has less impact (For Example: Changing Jquery version from 1.11.1 to 1.11.3 or vice versa), as it has changes related to bug fixes (at least as per documentation).

But it's not the same case when we move from an older version of  Jquery to latest. It can have a significant impact on functionality and to be frank, most of the people never think it.

Migration can have below impact at the application level.
  • Application jQuery code: We can handle this part as we know the code-flow. But yes it can be a time taking process, as lots of testing needed.
  • Jquery plugins (used in the application): This is a bit tricky part, as we don’t have code understanding(plugin code are uglified) most of time and fixing plugin code would be a nightmare. And there can be a lot of plugins where we can have an impact.

How to Migrate to Jquery3?

Jquery 3.x has significant changes. So, there are recommended migration steps that need to be followed before doing any upgradation.:
  • Upgrade the version of jQuery on the page to the latest 1.x or 2.x.
  • Add jQuery Migrate 1.x Plugin to the page.
  • [Optional] but recommended, update any plugins in use since later versions are usually the most compatible with recent versions of jQuery.
  • Validate page and resolve any warnings that appear on the console, using the JQMIGRATE 1.x warning documentation as a guide.
  • Remove the jQuery Migrate 1.x plugin and ensure that the updated jQuery code on the page continues to work properly with only the latest jQuery 1.x/2.x in use.
  • Upgrade the version of jQuery on the page to the latest 3.x version and add jQuery Migrate 3.x plugin to the page.
  • Test the page and resolve any warnings that appear on the console, using the JQMIGRATE 3.x warning documentation as a guide.
  • Remove the jQuery Migrate 3.x plugin and ensure that the page continues to work properly with only the latest jQuery 3.x in use.

Official Jquery Upgrdation Guide.

Methods Deprecated in Jquery3 and Higher -

error()
success()
complete()
load()
unload()
pipe()
interval
andSelf()
size()
data()
removeAttr()
offset()
param()
swap()
bind()
unbind()
delegate()
undelegate()
on("ready")
parseJSON()
isNumeric()
expr[':']
filters
props
concat()
fixHooks
holdReady()
click()
hover()
attrFn
boxModel
browser
sub()
toggle()
live()
attr()
isResolved()
isRejected()
clean()
swap()

Methods Deprecated in Jquery2.2 -

andSelf()
bind()
contextdeferred
isRejected()
isResolved()
pipe()
delegate()
die()
error()
jQuery.boxModel
jQuery.browser
jQuery.fx
interval
jQuery.sub()
jQuery.support
live()
load()
selector
size()
toggle()
unbind()
undelegate()
unload()
jQuery.expr[":"]

Please do Comment, Like and Subscribe 

0 comments: