Make WordPress Core


Ignore:
Timestamp:
01/05/2026 04:02:03 PM (9 months ago)
Author:
jonsurrell
Message:

Scripts: Remove default attributes 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/10664.

Follow-up to [61411], [46164].

Props jonsurrell, sabernhardt, westonruter.
Fixes #64428. See #59883, #64442.

File:
1 edited

Legend:

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

    r61380 r61440  
    273273function media_send_to_editor( $html ) {
    274274        ?>
    275         <script type="text/javascript">
     275        <script>
    276276        var win = window.dialogArguments || opener || parent || top;
    277277        win.send_to_editor( <?php echo wp_json_encode( $html, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ); ?> );
    … …  
    551551
    552552        ?>
    553         <script type="text/javascript">
     553        <script>
    554554        addLoadEvent = function(func){if(typeof jQuery!=='undefined')jQuery(function(){func();});else if(typeof wpOnload!=='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
    555555        var ajaxurl = '<?php echo esc_js( admin_url( 'admin-ajax.php', 'relative' ) ); ?>', pagenow = 'media-upload-popup', adminpage = 'media-upload-popup',
    … …  
    613613        </head>
    614614        <body<?php echo $body_id_attr; ?> class="wp-core-ui no-js">
    615         <script type="text/javascript">
     615        <script>
    616616        document.body.className = document.body.className.replace('no-js', 'js');
    617617        </script>
    … …  
    624624
    625625        ?>
    626         <script type="text/javascript">if(typeof wpOnload==='function')wpOnload();</script>
     626        <script>if(typeof wpOnload==='function')wpOnload();</script>
    627627        </body>
    628628        </html>
    … …  
    822822        if ( isset( $_POST['insert-gallery'] ) || isset( $_POST['update-gallery'] ) ) {
    823823                ?>
    824                 <script type="text/javascript">
     824                <script>
    825825                var win = window.dialogArguments || opener || parent || top;
    826826                win.tb_remove();
    … …  
    20712071        $post_id = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0;
    20722072
    2073         echo '<script type="text/javascript">post_id = ' . $post_id . ';</script>';
     2073        echo '<script>post_id = ' . $post_id . ';</script>';
    20742074
    20752075        if ( empty( $_GET['chromeless'] ) ) {
    … …  
    22202220
    22212221        ?>
    2222         <script type="text/javascript">
     2222        <script>
    22232223        <?php
    22242224        // Verify size is an int. If not return default value.
    … …  
    23622362        <?php media_upload_form( $errors ); ?>
    23632363
    2364         <script type="text/javascript">
     2364        <script>
    23652365        jQuery(function($){
    23662366                var preloaded = $(".media-item.preloaded");
    … …  
    24282428        <h3 class="media-title"><?php _e( 'Insert media from another website' ); ?></h3>
    24292429
    2430         <script type="text/javascript">
     2430        <script>
    24312431        var addExtImage = {
    24322432
    … …  
    25692569
    25702570        ?>
    2571         <script type="text/javascript">
     2571        <script>
    25722572        jQuery(function($){
    25732573                var preloaded = $(".media-item.preloaded");
    … …  
    28972897        <?php wp_nonce_field( 'media-form' ); ?>
    28982898
    2899         <script type="text/javascript">
     2899        <script>
    29002900        jQuery(function($){
    29012901                var preloaded = $(".media-item.preloaded");
Note: See TracChangeset for help on using the changeset viewer.