diff --git a/wp-content/themes/twentytwenty/assets/js/index.js b/wp-content/themes/twentytwenty/assets/js/index.js index 60b007ccef..9234f11976 100644 --- a/wp-content/themes/twentytwenty/assets/js/index.js +++ b/wp-content/themes/twentytwenty/assets/js/index.js @@ -71,18 +71,21 @@ if ( ! Element.prototype.matches ) { // Add a class to the body for when touch is enabled for browsers that don't support media queries // for interaction media features. Adapted from -( function() { - var matchMedia = function() { - // Include the 'heartz' as a way to have a non matching MQ to help terminate the join. See . - var prefixes = [ '-webkit-', '-moz-', '-o-', '-ms-' ]; - var query = [ '(', prefixes.join( 'touch-enabled),(' ), 'heartz', ')' ].join( '' ); - return window.matchMedia && window.matchMedia( query ).matches; - }; +twentytwenty.touchEnabled = { - if ( ( 'ontouchstart' in window ) || ( window.DocumentTouch && document instanceof window.DocumentTouch ) || matchMedia() ) { - document.body.classList.add( 'touch-enabled' ); + init: function() { + var matchMedia = function() { + // Include the 'heartz' as a way to have a non matching MQ to help terminate the join. See . + var prefixes = [ '-webkit-', '-moz-', '-o-', '-ms-' ]; + var query = [ '(', prefixes.join( 'touch-enabled),(' ), 'heartz', ')' ].join( '' ); + return window.matchMedia && window.matchMedia( query ).matches; + }; + + if ( ( 'ontouchstart' in window ) || ( window.DocumentTouch && document instanceof window.DocumentTouch ) || matchMedia() ) { + document.body.classList.add( 'touch-enabled' ); + } } -}() ); +}; // twentytwenty.touchEnabled /* ----------------------------------------------------------------------------------------------- Cover Modals @@ -745,6 +748,7 @@ twentytwentyDomReady( function() { twentytwenty.smoothScroll.init(); // Smooth scroll to anchor link or a specific element twentytwenty.modalMenu.init(); // Modal Menu twentytwenty.primaryMenu.init(); // Primary Menu + twentytwenty.touchEnabled.init(); // Add class to body if device is touch-enabled } ); /* ----------------------------------------------------------------------------------------------- diff --git a/wp-includes/version.php b/wp-includes/version.php index 118e5a8f00..ee77d533ff 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.4-alpha-46785'; +$wp_version = '5.4-alpha-46786'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.