Make WordPress Core

Ticket #42804: 42804.2.diff

File 42804.2.diff, 1.6 KB (added by azaozz, 6 years ago)
  • src/wp-includes/class.wp-scripts.php

     
    149149         * @since 3.4.0
    150150         */
    151151        public function init() {
    152                 if ( ! is_admin() && ! current_theme_supports( 'html5', 'script' ) ) {
     152                if ( function_exists( 'is_admin' ) && ! is_admin() && function_exists( 'current_theme_supports' ) && ! current_theme_supports( 'html5', 'script' ) ) {
    153153                        $this->type_attr = " type='text/javascript'";
    154154                }
    155155
     
    220220                        return $output;
    221221                }
    222222
    223                 echo "<script{$this->type_attr}>\n"; // CDATA and type="text/javascript" is not needed for HTML 5.
    224                 echo "/* <![CDATA[ */\n";
     223                echo "<script{$this->type_attr}>\n";
     224
     225                if ( $this->type_attr ) {
     226                        echo "/* <![CDATA[ */\n";
     227                }
     228
    225229                echo "$output\n";
    226                 echo "/* ]]> */\n";
     230
     231                if ( $this->type_attr ) {
     232                        echo "/* ]]> */\n";
     233                }
     234
    227235                echo "</script>\n";
    228236
    229237                return true;
  • src/wp-includes/class.wp-styles.php

     
    117117         * @since 2.6.0
    118118         */
    119119        public function __construct() {
    120                 if ( ! is_admin() && ! current_theme_supports( 'html5', 'style' ) ) {
     120                if ( function_exists( 'is_admin' ) && ! is_admin() && function_exists( 'current_theme_supports' ) && ! current_theme_supports( 'html5', 'style' ) ) {
    121121                        $this->type_attr = " type='text/css'";
    122122                }
    123123