Using obsolete code (type=”text/javascript”)
-
validator.w3.org shows the warning when using async or defer script minifying :
“The type attribute is unnecessary for JavaScript resources.
From line 153, column 1; to line 153, column 101
<script defer type=”text/javascript” src=”/wp-content/cache/minify/c740d.js”>”The reason: type=”text/javascript” attribute is obsolete in html5, and you may freely remove it from the code everywhere.
I suggest some changes to Minify_Plugin.php:
/**
* Prints script tag
*
* @param string $url
* @param string $embed_type
* @return string
*/
function generate_script_tag( $url, $embed_type = ‘blocking’ ) {
static $non_blocking_function = false;if ( $embed_type == ‘blocking’ ) {
$script = ‘<script src=”‘ .
str_replace( ‘&’, ‘&’, $url ) . ‘”></script>’;
} else {
$script = ”;if ( $embed_type == ‘nb-js’ ) {
if ( !$non_blocking_function ) {
$non_blocking_function = true;
$script = “<script>function w3tc_load_js(u){var d=document,p=d.getElementsByTagName(‘HEAD’)[0],c=d.createElement(‘script’);c.src=u;p.appendChild(c);}</script>”;
}$script .= “<script>w3tc_load_js(‘” .
$url . “‘);</script>”;} else if ( $embed_type == ‘nb-async’ ) {
$script = ‘<script async src=”‘ .
str_replace( ‘&’, ‘&’, $url ) . ‘”></script>’;
} else if ( $embed_type == ‘nb-defer’ ) {
$script = ‘<script defer src=”‘ .
str_replace( ‘&’, ‘&’, $url ) . ‘”></script>’;
} else if ( $embed_type == ‘extsrc’ ) {
$script = ‘<script extsrc=”‘ .
str_replace( ‘&’, ‘&’, $url ) . ‘”></script>’;
} else if ( $embed_type == ‘asyncsrc’ ) {
$script = ‘<script asyncsrc=”‘ .
str_replace( ‘&’, ‘&’, $url ) . ‘”></script>’;
}
}return $script . “\r\n”;
}The page I need help with: [log in to see the link]
The topic ‘Using obsolete code (type=”text/javascript”)’ is closed to new replies.