• Stars
    star
    2,006
  • Rank 23,087 (Top 0.5 %)
  • Language
    JavaScript
  • License
    Other
  • Created about 12 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A development tool to help migrate away from APIs and features that have been or will be removed from jQuery core

CI Status

NOTE: To upgrade to jQuery 3.0, you first need version 1.12.x or 2.2.x. If you're using an older version, first upgrade to one of these versions using jQuery Migrate 1.x, to resolve any compatibility issues. For more information about the changes made in jQuery 3.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[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 iOS 7+ (and not just 3 latest versions), use jQuery Migrate 3.x.

Usage

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

<script src="https://code.jquery.com/jquery-3.7.0.js"></script>
<script src="https://code.jquery.com/jquery-migrate-3.4.1.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-3.4.1.js jquery-migrate-3.4.1.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. 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 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.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.

jQuery.migrateMute: Set this property to true to 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 false if you want warnings but do not want stack traces to appear on the console.

jQuery.migrateReset(): This method clears the jQuery.migrateWarnings 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.migrateDeduplicateWarnings: 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

Build with grunt

$ git clone git://github.com/jquery/jquery-migrate.git
$ cd jquery-migrate
$ npm install
$ npm install -g grunt-cli
$ grunt build

Run tests

$ npm test

Or

$ grunt test

More Repositories

1

jquery

jQuery JavaScript Library
JavaScript
59,064
star
2

jquery-ui

The official jQuery user interface library.
JavaScript
11,252
star
3

esprima

ECMAScript parsing infrastructure for multipurpose analysis
TypeScript
7,020
star
4

sizzle

A sizzlin' hot selector engine.
JavaScript
6,278
star
5

jquery-mousewheel

A jQuery plugin that adds cross-browser mouse wheel support.
JavaScript
3,897
star
6

jquery-color

jQuery plugin for color manipulation and animation support.
JavaScript
1,639
star
7

testswarm

Distributed continuous integration testing for JavaScript.
PHP
968
star
8

learn.jquery.com

jQuery Learning Center web site content
JavaScript
924
star
9

api.jquery.com

API documentation for jQuery Core
HTML
318
star
10

jquery-wp-content

WordPress themes and plugins for the jQuery sites
PHP
252
star
11

jquery-simulate

jQuery Event Unit Testing Helpers
JavaScript
173
star
12

themeroller.jquerymobile.com

ThemeRoller site for jQuery Mobile
CSS
140
star
13

jqueryui.com

jQuery UI web site content
HTML
133
star
14

jquery-dist

Distribution repo for jQuery Core releases
JavaScript
102
star
15

download.jqueryui.com

Download Builder for jQuery UI
JavaScript
86
star
16

jquery.com

jQuery web site content
HTML
77
star
17

api.jqueryui.com

API documentation for jQuery UI
HTML
70
star
18

codeorigin.jquery.com

jQuery CDN
JavaScript
57
star
19

jquerymobile.com

jQuery Mobile web site content
HTML
54
star
20

api.jquerymobile.com

API documentation for jQuery Mobile
HTML
54
star
21

jquery.org

jQuery Foundation web site content
HTML
51
star
22

gsoc

Home for the jQuery Foundations ideas list for Google Summer of Code 2015
41
star
23

grunt-jquery-content

XSLT
38
star
24

typesense-minibar

Fast 2kB autocomplete search bar. Alternative to Algolia DocSearch, InstantSearch, and autocomplete-js.
JavaScript
36
star
25

eslint-config-jquery

jQuery's eslint config, enforcing the jQuery styleguide
JavaScript
32
star
26

meetings.jquery.org

Calendar and minutes of public jQuery team meetings
JavaScript
27
star
27

testswarm-browserstack

Integration layer between TestSwarm and BrowserStack
JavaScript
26
star
28

contribute.jquery.org

Developer documentation common to jQuery projects
HTML
25
star
29

jquery-release

Release automation script for jQuery projects
JavaScript
24
star
30

demos.jquerymobile.com

jQuery Mobile demo site
HTML
21
star
31

2012-dev-summit

Information regarding the 2012 Developer Summit in DC
15
star
32

jquery-license

jQuery Foundation License Verification
JavaScript
12
star
33

2015-developer-summit

a sandbox site for making mistakes
HTML
10
star
34

globalizejs.com

Globalize web site content
JavaScript
10
star
35

irc.jquery.org

jQuery Foundation IRC channels and logs site content
HTML
9
star
36

brand.jquery.org

Information on jQuery's branding
HTML
8
star
37

events.jquery.org

jQuery Events & Conferences web site content
HTML
8
star
38

node-amd-builder

jQuery Mobile download builder, a Node.js service
JavaScript
7
star
39

jquery.github.io

HTML
7
star
40

infrastructure-puppet

Puppet configuration for jQuery Infrastructure servers.
HTML
6
star
41

ci-management

Shell
5
star
42

jquery-compat-dist

Distribution repo for jQuery Core Compat releases
JavaScript
5
star
43

healthyweb.org

Check any website for the latest version of jQuery
Svelte
4
star
44

content

Content Team
3
star
45

blog.jquery.com-theme

Themes for blogs during transition period to jquery-wp-content.
CSS
2
star
46

node-packager

Build a package for your library or application on the fly on Node.js
JavaScript
2
star
47

podcast.jquery.com

HTML
1
star