Make WordPress Core

Changeset 61578


Ignore:
Timestamp:
02/02/2026 06:39:13 PM (9 months ago)
Author:
westonruter
Message:

General: Preserve back-compat for wp.sanitize.stripTags() to return empty string when passed null/undefined.

This also bumps the esversion to 11 in tests/qunit/.jshintrc to match the root .jshintrc, following [61544] for #64562.

Follow-up to [61347], [60907].

Props westonruter, jonsurrell, mukesh27, hugod.
See #64274.
Fixes #64574.

Location:
trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/wp/sanitize.js

    r61347 r61578  
    2424                 */
    2525                stripTags: function( text ) {
     26                        if ( null === text || 'undefined' === typeof text ) {
     27                                return '';
     28                        }
     29
    2630                        const domParser = new DOMParser();
    2731                        const htmlDocument = domParser.parseFromString(
  • trunk/tests/qunit/.jshintrc

    r48978 r61578  
    11{
     2        "esversion": 11,
    23        "globals": {
    34                "QUnit"          : false,
  • trunk/tests/qunit/index.html

    r60806 r61578  
    156156                <script src="wp-includes/js/jquery.js"></script>
    157157                <script src="wp-includes/js/wp-api.js"></script>
     158                <script src="wp-includes/js/wp-sanitize.js"></script>
    158159                <script src="wp-admin/js/customize-controls.js"></script>
    159160                <script src="wp-admin/js/customize-controls-utils.js"></script>
Note: See TracChangeset for help on using the changeset viewer.