WordPress.org

Make WordPress Core


Ignore:
Timestamp:
09/18/2019 02:49:30 PM (9 months ago)
Author:
SergeyBiryukov
Message:

Script Loader: Introduce HTML5 support for scripts and styles.

When a theme declares HTML5 support for script and styles via add_theme_support( 'html5', array( 'script', 'style' ) ), the type="text/javascript" and type="text/css" attributes are omitted.

These attributes are unnecessary in HTML5 and cause warnings in the W3C Markup Validation Service.

Props sasiddiqui, swissspidy, knutsp, SergeyBiryukov.
See #42804.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/widgets/class-wp-widget-recent-comments.php

    r45932 r46164  
    5454            return;
    5555        }
    56         ?>
    57         <style type="text/css">.recentcomments a{display:inline !important;padding:0 !important;margin:0 !important;}</style>
    58         <?php
     56
     57        $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
     58
     59        printf(
     60            '<style%s>.recentcomments a{display:inline !important;padding:0 !important;margin:0 !important;}</style>',
     61            $type_attr
     62        );
    5963    }
    6064
Note: See TracChangeset for help on using the changeset viewer.