Skip to content

Commit

Permalink
Docs: Add an entry for legacy-self-closed-tags in warnings.md
Browse files Browse the repository at this point in the history
This was missed in gh-518.

Closes gh-526
Ref gh-518

Co-authored-by: Timmy Willison <[email protected]>
  • Loading branch information
mgol and timmywil authored Jul 26, 2024
1 parent cb31bcb commit 5845951
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions warnings.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 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" )`.

### \[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 `<i class="test" />` that the HTML5 specification says are not self-closed, turning it into `<i class="test"></i>`. 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.
Expand Down

0 comments on commit 5845951

Please sign in to comment.