Make WordPress Core


Ignore:
Timestamp:
12/26/2025 01:14:22 PM (8 months ago)
Author:
jonsurrell
Message:

Scripts: Remove default type attribute from tags.

SCRIPT, STYLE, and stylesheet LINK tags do not require a type attribute since the HTML5 standard was released in 2008. Removing the type attribute simplifies logic and normalizes the produced HTML content.

Developed in https://github.com/WordPress/wordpress-develop/pull/10658.

Follow-up to [46164].

Props hardikhuptechdev, jonsurrell, dmsnell, westonruter.
Fixes #64428. See #59883, #64442.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/deprecated.php

    r60910 r61411  
    58985898        _deprecated_function( __FUNCTION__, '6.4.0', 'wp_enqueue_embed_styles' );
    58995899
    5900         $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
    5901         $suffix    = SCRIPT_DEBUG ? '' : '.min';
     5900        $suffix = SCRIPT_DEBUG ? '' : '.min';
    59025901        ?>
    5903         <style<?php echo $type_attr; ?>>
     5902        <style>
    59045903                <?php echo file_get_contents( ABSPATH . WPINC . "/css/wp-embed-template$suffix.css" ); ?>
    59055904        </style>
     
    59235922        $printed = true;
    59245923
    5925         $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
    59265924        ?>
    5927         <style<?php echo $type_attr; ?>>
     5925        <style>
    59285926        img.wp-smiley,
    59295927        img.emoji {
     
    59505948function wp_admin_bar_header() {
    59515949        _deprecated_function( __FUNCTION__, '6.4.0', 'wp_enqueue_admin_bar_header_styles' );
    5952         $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
    59535950        ?>
    5954         <style<?php echo $type_attr; ?> media="print">#wpadminbar { display:none; }</style>
     5951        <style media="print">#wpadminbar { display:none; }</style>
    59555952        <?php
    59565953}
     
    59645961function _admin_bar_bump_cb() {
    59655962        _deprecated_function( __FUNCTION__, '6.4.0', 'wp_enqueue_admin_bar_bump_styles' );
    5966         $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
    59675963        ?>
    5968         <style<?php echo $type_attr; ?> media="screen">
     5964        <style media="screen">
    59695965        html { margin-top: 32px !important; }
    59705966        @media screen and ( max-width: 782px ) {
Note: See TracChangeset for help on using the changeset viewer.