Make WordPress Core


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

    r44589 r46164  
    9090
    9191            echo '</form>';
     92
     93            $type_attr = current_theme_supports( 'html5', 'script' ) ? '' : ' type="text/javascript"';
    9294            ?>
    9395
    94 <script type='text/javascript'>
     96<script<?php echo $type_attr; ?>>
    9597/* <![CDATA[ */
    9698(function() {
Note: See TracChangeset for help on using the changeset viewer.