Make WordPress Core


Ignore:
Timestamp:
08/10/2023 07:47:08 PM (10 months ago)
Author:
westonruter
Message:

Embeds: Modernize wp-embed script with removal of obsolete IE10/IE11 code and support for WP<4.4.

  • Remove obsolete load event handler in wp-embed since IE10+ support DOMContentLoaded.
  • Replace obsolete use of document.createElement('a') in favor of the newer URL class (supported in all browsers but obsolete IE11).
  • Remove obsolete IE10/IE11 code.
  • Combine conditionals.
  • Use substring() instead of deprecated substr() method.
  • Eliminate the stipulation that wp-embed.js not include ampersands, considering this was put in place for WP<4.3 which now accounts for only 1.43% of sites. This includes the elimination of the verify:wp-embed grunt task.

Props westonruter, swissspidy.
Fixes #58974.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/oembed/template.php

    r52978 r56383  
    344344        $this->assertFalse( $scripts->query( 'wp-embed', 'enqueued' ) );
    345345    }
    346 
    347     /**
    348      * Confirms that no ampersands exist in src/wp-includes/js/wp-embed.js.
    349      *
    350      * See also the `verify:wp-embed` Grunt task for verifying the built file.
    351      *
    352      * @ticket 34698
    353      */
    354     public function test_js_no_ampersands() {
    355         $this->assertStringNotContainsString( '&', file_get_contents( ABSPATH . WPINC . '/js/wp-embed.js' ) );
    356     }
    357346}
Note: See TracChangeset for help on using the changeset viewer.