Bạn đang xem: Jquery migrate là gì
Launching Visual Studio Code Your codespace will xuất hiện once ready.
There was a problem preparing your codespace, please try again.
NOTE: to upgrade to lớn jQuery 3.0, you first need version 1.12.x or 2.2.x. If you"re using an older version, first upgrade lớn one of these versions using jQuery Migrate 1.x, to lớn resolve any compatibility issues. For more information about the changes made in jQuery 3.0, see the upgrade guide & blog post.jQuery MigrateUpgrading libraries such as jQuery can be a lot of work, when breaking changes have been introduced. JQuery Migrate makes this easier, by restoring the APIs that were removed, and additionally shows warnings in the browser console (development version of jQuery Migrate only) when removed and/or deprecated APIs are used.
That way you can spot & fix what otherwise would have been errors, until you no longer need jQuery Migrate & can remove it.
Version compatibilityThe following table indicates which jQuery Migrate versions can be used with which jQuery versions:
1.x | 1.x |
2.x | 1.x |
3.x | 3.x / 4.x<1> |
4.x | 3.x / 4.x<1> |
<1> NOTE: jQuery Migrate 4.x only supports the same browser as jQuery 4.x does. If you need to support Edge Legacy, internet Explorer 9-10 or quả táo 7+ (and not just 3 latest versions), use jQuery Migrate 3.x.
UsageIn your website page, load this plugin after the script tag for jQuery, for example:
script src="https://code.jquery.com/jquery-3.6.0.js">script>script src="https://code.jquery.com/jquery-migrate-3.4.0.js">script>
Debugging enabled | ✓ | |
Minified | ✓ | |
Latest release (may be hotlinked if desired) | jquery-migrate-3.4.0.js | jquery-migrate-3.4.0.min.js |
* Latest work-in-progress build | jquery-migrate-git.js | jquery-migrate-git.min.js |
* Work-in-progress build: Although this file represents the most recent updates to the plugin, it may not have been thoroughly tested. We vày not recommend using this tệp tin on production sites since it may be unstable; use the released production version instead.
DebuggingThe development version of the plugin displays warnings in the browser console. Older browsers such as IE9 doesn"t support the console interface. No messages will be generated unless you include a debugging library such as Firebug Lite before including the jQuery Migrate plugin. Developers can also inspect the jQuery.migrateWarnings array to see what error messages have been generated.
All warnings generated by this plugin start with the string "JQMIGRATE". A các mục of the warnings you may see are in warnings.md.
Migrate Plugin APIThis plugin adds some properties to lớn the jQuery object that can be used to programmatically control & examine its behavior:
jQuery.migrateWarnings: This property is an array of string warning messages that have been generated by the code on the page, in the order they were generated. Messages appear in the array only once, even if the condition has occurred multiple times, unless jQuery.migrateReset() is called.
Xem thêm: Giải Đáp Thắc Mắc Nên Uống Bột Sắn Dây Khi Nào Là Tốt Nhất Và Chú Ý Gì?
jQuery.migrateMute: phối this property to lớn true lớn prevent console warnings from being generated in the development version. The jQuery.migrateWarnings array is still maintained when this property is set, which allows programmatic inspection without console output.
jQuery.migrateTrace: set this property to lớn false if you want warnings but bởi not want stack traces khổng lồ appear on the console.
jQuery.migrateReset(): This method clears the jQuery.migrateWarnings array & "forgets" the các mục of messages that have been seen already.
jQuery.migrateVersion: This string property indicates the version of Migrate in use.
jQuery.migrateDeduplicateWarnings: By default, Migrate only gives a specific warning once. If you set this property to lớn false it will give a warning for every occurrence each time it happens. Chú ý that this can generate a lot of output, for example when a warning occurs in a loop.
jQuery.migrateDisablePatches: Disables patches by their codes. You can find a code for each patch in square brackets in warnings.md. A limited number of warnings doesn"t have codes defined and cannot be disabled. These are mostly thiết đặt issues like using an incorrect version of jQuery or loading Migrate multiple times.
jQuery.migrateDisablePatches: Disables patches by their codes.
jQuery.migrateIsPatchEnabled: Returns true if a patch of a provided code is enabled & false otherwise.
jQuery.UNSAFE_restoreLegacyHtmlPrefilter: A deprecated alias of jQuery.migrateEnablePatches( "self-closed-tags" )
Reporting problemsBugs that only occur when the jQuery Migrate plugin is used should be reported in the jQuery Migrate Issue Tracker and should be accompanied by an executable thử nghiệm case that demonstrates the bug. The easiest way to vì this is via an online chạy thử tool such as jsFiddle.net or jsbin.com. Use the development version when you are reporting bugs.
Bugs in jQuery itself should be reported on the jQuery chip core bug tracker và again should be accompanied by a test case from jsFiddle.net or jsbin.com so that we can reproduce the issue.