admin管理员组文章数量:1332890
I am done upgrading jQuery from 1.3.1 to 1.12.4. Everything is working correctly and I am ready to remove jquery-migrate-1.4.1.js because I was only using it for debugging purposes during the upgrade process.
When I remove jquery-migrate-1.4.1.js from the <head>
section of my website, the page does not work properly anymore. Something breaks in the JavaScript/jQuery. I was reading / trying to find information about it, and this is something I found:
Remove the Migrate 1.x plugin and ensure the page still works properly without it loaded.
Why do I need jquery-migrate-1.4.1.js after a successful jQuery upgrade? I thought it was only a "behind the scenes" script for debugging purposes exclusively, not to maintain any jQuery/JavaScript functionality.
I am done upgrading jQuery from 1.3.1 to 1.12.4. Everything is working correctly and I am ready to remove jquery-migrate-1.4.1.js because I was only using it for debugging purposes during the upgrade process.
When I remove jquery-migrate-1.4.1.js from the <head>
section of my website, the page does not work properly anymore. Something breaks in the JavaScript/jQuery. I was reading https://blog.jquery./2016/05/19/jquery-migrate-1-4-1-released-and-the-path-to-jquery-3-0/ trying to find information about it, and this is something I found:
Remove the Migrate 1.x plugin and ensure the page still works properly without it loaded.
Why do I need jquery-migrate-1.4.1.js after a successful jQuery upgrade? I thought it was only a "behind the scenes" script for debugging purposes exclusively, not to maintain any jQuery/JavaScript functionality.
Share Improve this question edited Feb 20, 2018 at 14:39 Jaime Montoya asked Oct 25, 2017 at 20:53 Jaime MontoyaJaime Montoya 7,73117 gold badges78 silver badges118 bronze badges 10- Sounds like you did not fix everything if it breaks without it. What are the errors are you seeing when you remove it? – epascarello Commented Oct 25, 2017 at 20:56
- So, what is going wrong? What is not working and what is in the console? Maybe that could shed a hint on why the page doesn't work as expected anymore – Icepickle Commented Oct 25, 2017 at 20:56
- 2 jQuery Migrate's purpose is to allow you to use deprecated features while still using a newer version of the library. It's not just a "behind the scenes" thing. It will log when you are using deprecated features but the intent is to allow you to use newer libraries without removing code that has been removed from the newer libraries. – steve v Commented Oct 25, 2017 at 21:00
- 1 It's kind of both, the console.logs help you clean up while the workarounds let you maintain functionality until you cleaned up your code. – Jason Sperske Commented Oct 25, 2017 at 23:29
- 2 You should be looking for size().....not the full string... and $.browser is probably the other thing to look at.... – epascarello Commented Oct 26, 2017 at 1:18
1 Answer
Reset to default 4The misunderstanding that is tripping you up at the moment is that the purpose of jquery-migrate-1.4.1.js
is to install a few backward focused workarounds to make early jQuery code work in the more up to date jQuery while also plaining into your console.log so you can fix it. It is not actually changing your code. A couple of pointers to help you migrate based on your ments:
I see for example: "JQMIGRATE: jQuery.browser is deprecated". That is odd though, because the source of that error is jquery-migrate-1.4.1.js:45 and that is the jquery-migrate-1.4.1.js file, not that I am using jQuery.browser in my code.
The line doing the logging is in the jquery-migrate-1.4.1.js
so the error appears to point to that file, however, the line calling jQuery.browser
might be in a plugin you are loading (this was mon in early jQuery days where people wrote browser-specific hacks) You can try and search for .browser
in all of your linked .js
files (even the minified ones) to at least isolate the plugin and then try to find alternatives.
I see things such as: "jquery-migrate-1.4.1.js:45 JQMIGRATE: jQuery.fn.size() is deprecated; use the .length property". But I cannot find jQuery.fn.size() in my source code.
The approach of jQuery.fn.size()
might show up in your code like this:
$('li.items').size()
jQuery.fn
is just the object name of a jQuery element's functions. Because your jQuery object is based on a jQuery selector you wrote it might be hard to search for it, instead look for something like .size()
and if it shows up to the right of a jQuery selector then try and replace it with just .length
(no parentheses, as length
is just a property).
If you have other questions you are probably better off posting them as new questions so they can get more direct and generally helpful answers.
本文标签: javascriptWhy do I need jquerymigrate141js after a successful jQuery upgradeStack Overflow
版权声明:本文标题:javascript - Why do I need jquery-migrate-1.4.1.js after a successful jQuery upgrade? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742306973a2450110.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论