Skip to content
프로젝트

소개

jQuery 코어에서 이미 제거되었거나 제거될 예정인 API와 기능으로부터의 마이그레이션을 지원하는 개발 도구

기타 프로젝트

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
-1

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

CI Status

NOTE: To upgrade to jQuery 4.x, you first need version 3.x. If you're using an older version, first upgrade to jQuery 3.x using jQuery Migrate 3.x, to resolve any compatibility issues. For more information about the changes made in jQuery 4.0, see the upgrade guide and blog post.

jQuery Migrate

Upgrading 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 and fix what otherwise would have been errors, until you no longer need jQuery Migrate and can remove it.

Version compatibility

The following table indicates which jQuery Migrate versions can be used with which jQuery versions:

jQuery version jQuery Migrate version
1.x 1.x
2.x 1.x
3.x 3.x
4.x 4.x

Each jQuery Migrate version supports the same browsers that the jQuery version used with it. See the jQuery Browser Support page for more information.

Usage

In your web page, load this plugin after the script tag for jQuery, for example:

<script src="https://code.jquery.com/jquery-4.0.0.js"></script>
<script src="https://code.jquery.com/jquery-migrate-4.0.2.js"></script>

Download

Development vs. Production versions

The production build is minified and does not generate console warnings. It will only generate a console log message upon loading, or if it detects an error such as an outdated version of jQuery that it does not support. Do not use this file for development or debugging, it will make your life miserable.

Development Production
Debugging enabled

✓

Minified

✓

Latest release (may be hotlinked if desired) jquery-migrate-4.0.2.js jquery-migrate-4.0.2.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 do not recommend using this file on production sites since it may be unstable; use the released production version instead.

Debugging

The development version of the plugin displays warnings in the browser console. Developers can also inspect the jQuery.migrateMessages array to see what error messages have been generated.

All warnings generated by this plugin start with the string "JQMIGRATE". A list of the warnings you may see are in warnings.md.

Migrate Plugin API

This plugin adds some properties to the jQuery object that can be used to programmatically control and examine its behavior:

jQuery.migrateMessages: 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.

jQuery.migrateMute: Set this property to true to prevent console warnings from being generated in the development version. The jQuery.migrateMessages array is still maintained when this property is set, which allows programmatic inspection without console output.

jQuery.migrateTrace: Set this property to false if you want warnings but do not want stack traces to appear on the console.

jQuery.migrateReset(): This method clears the jQuery.migrateMessages array and "forgets" the list of messages that have been seen already.

jQuery.migrateVersion: This string property indicates the version of Migrate in use.

jQuery.migrateDeduplicateMessages: By default, Migrate only gives a specific warning once. If you set this property to false it will give a warning for every occurrence each time it happens. Note 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 setup 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 and false otherwise.

jQuery.UNSAFE_restoreLegacyHtmlPrefilter: A deprecated alias of jQuery.migrateEnablePatches( "self-closed-tags" )

Reporting problems

Bugs 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 test case that demonstrates the bug. The easiest way to do this is via an online test 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 Core bug tracker and again should be accompanied by a test case from jsFiddle.net or jsbin.com so that we can reproduce the issue.

For other questions about the plugin that aren't bugs, ask on the jQuery Forum.

Build and run tests:

Build with npm commands

$ git clone git://github.com/jquery/jquery-migrate.git
$ cd jquery-migrate
$ npm install
$ npm run build

Run tests

$ npm test

Or

$ npm run test:server

and open http://localhost:3000/test/ in your browser.

관련 프로젝트 살펴보기

불러오는 중…