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. Built from https://develop.svn.wordpress.org/trunk@46164 git-svn-id: http://core.svn.wordpress.org/trunk@45976 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -5435,8 +5435,10 @@ function print_emoji_styles() {
|
||||
}
|
||||
|
||||
$printed = true;
|
||||
|
||||
$type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
|
||||
?>
|
||||
<style type="text/css">
|
||||
<style<?php echo $type_attr; ?>>
|
||||
img.wp-smiley,
|
||||
img.emoji {
|
||||
display: inline !important;
|
||||
@@ -5517,7 +5519,8 @@ function _print_emoji_detection_script() {
|
||||
'svgExt' => apply_filters( 'emoji_svg_ext', '.svg' ),
|
||||
);
|
||||
|
||||
$version = 'ver=' . get_bloginfo( 'version' );
|
||||
$version = 'ver=' . get_bloginfo( 'version' );
|
||||
$type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/javascript"';
|
||||
|
||||
if ( SCRIPT_DEBUG ) {
|
||||
$settings['source'] = array(
|
||||
@@ -5528,7 +5531,7 @@ function _print_emoji_detection_script() {
|
||||
);
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
<script<?php echo $type_attr; ?>>
|
||||
window._wpemojiSettings = <?php echo wp_json_encode( $settings ); ?>;
|
||||
<?php readfile( ABSPATH . WPINC . '/js/wp-emoji-loader.js' ); ?>
|
||||
</script>
|
||||
@@ -5550,7 +5553,7 @@ function _print_emoji_detection_script() {
|
||||
* and edit wp-emoji-loader.js directly.
|
||||
*/
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
<script<?php echo $type_attr; ?>>
|
||||
window._wpemojiSettings = <?php echo wp_json_encode( $settings ); ?>;
|
||||
!function(a,b,c){function d(a,b){var c=String.fromCharCode;l.clearRect(0,0,k.width,k.height),l.fillText(c.apply(this,a),0,0);var d=k.toDataURL();l.clearRect(0,0,k.width,k.height),l.fillText(c.apply(this,b),0,0);var e=k.toDataURL();return d===e}function e(a){var b;if(!l||!l.fillText)return!1;switch(l.textBaseline="top",l.font="600 32px Arial",a){case"flag":return!(b=d([127987,65039,8205,9895,65039],[127987,65039,8203,9895,65039]))&&(!(b=d([55356,56826,55356,56819],[55356,56826,8203,55356,56819]))&&(b=d([55356,57332,56128,56423,56128,56418,56128,56421,56128,56430,56128,56423,56128,56447],[55356,57332,8203,56128,56423,8203,56128,56418,8203,56128,56421,8203,56128,56430,8203,56128,56423,8203,56128,56447]),!b));case"emoji":return b=d([55357,56424,55356,57342,8205,55358,56605,8205,55357,56424,55356,57340],[55357,56424,55356,57342,8203,55358,56605,8203,55357,56424,55356,57340]),!b}return!1}function f(a){var c=b.createElement("script");c.src=a,c.defer=c.type="text/javascript",b.getElementsByTagName("head")[0].appendChild(c)}var g,h,i,j,k=b.createElement("canvas"),l=k.getContext&&k.getContext("2d");for(j=Array("flag","emoji"),c.supports={everything:!0,everythingExceptFlag:!0},i=0;i<j.length;i++)c.supports[j[i]]=e(j[i]),c.supports.everything=c.supports.everything&&c.supports[j[i]],"flag"!==j[i]&&(c.supports.everythingExceptFlag=c.supports.everythingExceptFlag&&c.supports[j[i]]);c.supports.everythingExceptFlag=c.supports.everythingExceptFlag&&!c.supports.flag,c.DOMReady=!1,c.readyCallback=function(){c.DOMReady=!0},c.supports.everything||(h=function(){c.readyCallback()},b.addEventListener?(b.addEventListener("DOMContentLoaded",h,!1),a.addEventListener("load",h,!1)):(a.attachEvent("onload",h),b.attachEvent("onreadystatechange",function(){"complete"===b.readyState&&c.readyCallback()})),g=c.source||{},g.concatemoji?f(g.concatemoji):g.wpemoji&&g.twemoji&&(f(g.twemoji),f(g.wpemoji)))}(window,document,window._wpemojiSettings);
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user