You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Core: Support selectively disabling Migrate patches
This adds three new APIs:
* `jQuery.migrateDisablePatches`
* `jQuery.migrateEnablePatches`
* `jQuery.migrateIsPatchEnabled`
allowing to selectively disable/re-enable patches in runtime. Source code is
refactored to avoid manually overwriting jQuery methods in favor of using
`migratePatchAndWarnFunc` or `migratePatchFunc` which cooperate with above
methods.
The `jQuery.UNSAFE_restoreLegacyHtmlPrefilter` API, introduced in Migrate 3.2.0,
is now deprecated in favor of calling:
```js
jQuery.migrateEnablePatches( "self-closed-tags" );
```
The commit also reorganizes test code a bit, grouping modules testing patches
to jQuery modules in a separate directory and extracting tests of Migrate APIs
out of `core.js` to a separate `migrate.js` file. Helper files are now put in
`test/data/` and unit tests in `test/unit/`; jQuery patch tests are in
`test/unit/jquery/`.
Fixesgh-449
Copy file name to clipboardExpand all lines: README.md
+8
Original file line number
Diff line number
Diff line change
@@ -56,6 +56,14 @@ This plugin adds some properties to the `jQuery` object that can be used to prog
56
56
57
57
`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.
58
58
59
+
`jQuery.migrateDisablePatches`: Disables patches by their codes. You can find a code for each patch in square brackets in [warnings.md](https://github.com/jquery/jquery-migrate/blob/main/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.
60
+
61
+
`jQuery.migrateDisablePatches`: Disables patches by their codes.
62
+
63
+
`jQuery.migrateIsPatchEnabled`: Returns `true` if a patch of a provided code is enabled and `false` otherwise.
64
+
65
+
`jQuery.UNSAFE_restoreLegacyHtmlPrefilter`: A deprecated alias of `jQuery.migrateEnablePatches( "self-closed-tags" )`
66
+
59
67
## Reporting problems
60
68
61
69
Bugs that only occur when the jQuery Migrate plugin is used should be reported in the [jQuery Migrate Issue Tracker](https://github.com/jquery/jquery-migrate/issues) 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](https://jsFiddle.net/) or [jsbin.com](https://jsbin.com). Use the development version when you are reporting bugs.
0 commit comments