From bde0cb9a805bfde8ef65d855631afbecb1d78eca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Go=C5=82e=CC=A8biowski-Owczarek?= Date: Sat, 20 Jul 2024 00:25:02 +0200 Subject: [PATCH 1/2] Docs: Add an entry for `legacy-self-closed-tags` in `warnings.md` This was missed in gh-518. Ref gh-518 --- warnings.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/warnings.md b/warnings.md index 8817853a..b0a0df1f 100644 --- a/warnings.md +++ b/warnings.md @@ -271,6 +271,12 @@ See jQuery-ui [commit](https://github.com/jquery/jquery-ui/commit/c0093b599fcd58 **Solution:** Always pass string values to `.css()`, and explicitly add units where required. For example, use `$.css("line-height", "2")` to specify 200% of the current line height or `$.css("line-height", "2px")` to specify pixels. When the numeric value is in a variable, ensure the value is converted to string, e.g. `$.css("line-height", String(height))` and `$.css("line-height", height+"px")`. +### \[legacy-self-closed-tags\] JQMIGRATE: jQuery.UNSAFE_restoreLegacyHtmlPrefilter is deprecated + +**Cause:** jQuery Migrate 3.4.0 introduced a `jQuery.migrateEnablePatches` method used to enable any previously disabled patch. Since this method is more generic, it replaces the previous specialized `jQuery.UNSAFE_restoreLegacyHtmlPrefilter`. This warning is exceptional as it applies to jQuery Migrate and not to jQuery itself. + +**Solution:** Search for the `jQuery.UNSAFE_restoreLegacyHtmlPrefilter()` calls in the code base and replace all occurrences with `jQuery.migrateEnablePatches( "self-closed-tags" )`. + ### \[self-closed-tags\] JQMIGRATE: HTML tags must be properly nested and closed: _(HTML string)_ **Cause:** jQuery 3.5.0 changed the way it processes HTML strings. Previously, jQuery would attempt to fix self-closed tags like `` that the HTML5 specification says are not self-closed, turning it into ``. This processing can create a [security problem](https://nvd.nist.gov/vuln/detail/CVE-2020-11022) with malicious strings, so the functionality had to be removed. From 1de77523fb477d6a425c21e8d29dd1f1fd51b464 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Go=C5=82=C4=99biowski-Owczarek?= Date: Fri, 26 Jul 2024 21:26:57 +0200 Subject: [PATCH 2/2] Update warnings.md Co-authored-by: Timmy Willison --- warnings.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/warnings.md b/warnings.md index b0a0df1f..a65c59df 100644 --- a/warnings.md +++ b/warnings.md @@ -273,7 +273,7 @@ See jQuery-ui [commit](https://github.com/jquery/jquery-ui/commit/c0093b599fcd58 ### \[legacy-self-closed-tags\] JQMIGRATE: jQuery.UNSAFE_restoreLegacyHtmlPrefilter is deprecated -**Cause:** jQuery Migrate 3.4.0 introduced a `jQuery.migrateEnablePatches` method used to enable any previously disabled patch. Since this method is more generic, it replaces the previous specialized `jQuery.UNSAFE_restoreLegacyHtmlPrefilter`. This warning is exceptional as it applies to jQuery Migrate and not to jQuery itself. +**Cause:** jQuery Migrate 3.4.0 introduced a `jQuery.migrateEnablePatches` method used to enable any previously disabled patches. It should be used in place of the specialized `jQuery.UNSAFE_restoreLegacyHtmlPrefilter`. This warning is different as it applies to jQuery Migrate and not to jQuery itself. **Solution:** Search for the `jQuery.UNSAFE_restoreLegacyHtmlPrefilter()` calls in the code base and replace all occurrences with `jQuery.migrateEnablePatches( "self-closed-tags" )`.