WordPress.org

Make WordPress Core


Ignore:
Timestamp:
09/18/2019 02:49:30 PM (7 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/embed.php

    r45932 r46164  
    10011001 */
    10021002function print_embed_styles() {
     1003    $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
    10031004    ?>
    1004     <style type="text/css">
     1005    <style<?php echo $type_attr; ?>>
    10051006    <?php
    10061007    if ( SCRIPT_DEBUG ) {
     
    10321033 */
    10331034function print_embed_scripts() {
     1035    $type_attr = current_theme_supports( 'html5', 'script' ) ? '' : ' type="text/javascript"';
    10341036    ?>
    1035     <script type="text/javascript">
     1037    <script<?php echo $type_attr; ?>>
    10361038    <?php
    10371039    if ( SCRIPT_DEBUG ) {
Note: See TracChangeset for help on using the changeset viewer.