Ticket #64278: 64278.diff
| File 64278.diff, 26.0 KB (added by , 6 months ago) |
|---|
-
src/js/_enqueues/vendor/imgareaselect/jquery.imgareaselect.js
347 347 .add($area).width(w = selection.width).height(h = selection.height); 348 348 349 349 /* 350 * Reset the position of selection area, borders, and handles (IE6/IE7 351 * position them incorrectly if we don't do this) 350 * Reset the position of selection area, borders, and handles. 352 351 */ 353 352 $area.add($border).add($handles).css({ left: 0, top: 0 }); 354 353 … … 401 400 }); 402 401 } 403 402 404 /*405 * Internet Explorer displays 1px-wide dashed borders incorrectly by406 * filling the spaces between dashes with white. Toggling the margin407 * property between 0 and "auto" fixes this in IE6 and IE7 (IE8 is still408 * broken). This workaround is not perfect, as it requires setTimeout()409 * and thus causes the border to flicker a bit, but I haven't found a410 * better solution.411 *412 * Note: This only happens with CSS borders, set with the borderWidth,413 * borderOpacity, borderColor1, and borderColor2 options (which are now414 * deprecated). Borders created with GIF background images are fine.415 */416 if (msie && $border.outerWidth() - $border.innerWidth() == 2) {417 $border.css('margin', 0);418 setTimeout(function () { $border.css('margin', 'auto'); }, 0);419 }420 403 } 421 404 422 405 /** … … 1008 991 /* Append all the selection area elements to the container box */ 1009 992 $box.append($area.add($border).add($areaOpera)).append($handles); 1010 993 1011 if (msie) {1012 if (o = ($outer.css('filter')||'').match(/opacity=(\d+)/))1013 $outer.css('opacity', o[1]/100);1014 if (o = ($border.css('filter')||'').match(/opacity=(\d+)/))1015 $border.css('opacity', o[1]/100);1016 }1017 1018 994 if (newOptions.hide) 1019 995 hide($box.add($outer)); 1020 996 else if (newOptions.show && imgLoaded) { … … 1123 1099 this.update = doUpdate; 1124 1100 1125 1101 /* Do the dreaded browser detection */ 1126 var msie = (/msie ([\w.]+)/i.exec(ua)||[])[1], 1127 opera = /opera/i.test(ua), 1102 var opera = /opera/i.test(ua), 1128 1103 safari = /webkit/i.test(ua) && !/chrome/i.test(ua); 1129 1104 1130 1105 /* … … 1149 1124 */ 1150 1125 zIndex = options.zIndex || zIndex; 1151 1126 1152 if (msie)1153 $img.attr('unselectable', 'on');1154 1155 1127 /* 1156 * In MSIE and WebKit, we need to use the keydown event instead of keypress1128 * In WebKit, we need to use the keydown event instead of keypress. 1157 1129 */ 1158 $.imgAreaSelect.keyPress = msie ||safari ? 'keydown' : 'keypress';1130 $.imgAreaSelect.keyPress = safari ? 'keydown' : 'keypress'; 1159 1131 1160 1132 /* 1161 1133 * There is a bug affecting the CSS cursor property in Opera (observed in … … 1188 1160 img.complete || img.readyState == 'complete' || !$img.is('img') ? 1189 1161 imgLoad() : $img.one('load', imgLoad); 1190 1162 1191 /*1192 * MSIE 9.0 doesn't always fire the image load event -- resetting the src1193 * attribute seems to trigger it. The check is for version 7 and above to1194 * accommodate for MSIE 9 running in compatibility mode.1195 */1196 if (!imgLoaded && msie && msie >= 7)1197 img.src = img.src;1198 1163 }; 1199 1164 1200 1165 /** -
src/js/_enqueues/vendor/farbtastic.js
35 35 fb.square = 100; 36 36 fb.width = 194; 37 37 38 // Fix background PNGs in IE639 if (navigator.appVersion.match(/MSIE [0-6]\./)) {40 $('*', e).each(function () {41 if (this.currentStyle.backgroundImage != 'none') {42 var image = this.currentStyle.backgroundImage;43 image = this.currentStyle.backgroundImage.substring(5, image.length - 2);44 $(this).css({45 'backgroundImage': 'none',46 'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='" + image + "')"47 });48 }49 });50 }51 52 38 /** 53 39 * Link to the given element(s) or callback. 54 40 */ -
src/js/_enqueues/vendor/thickbox/thickbox.js
44 44 var $closeBtn; 45 45 46 46 try { 47 if (typeof document.body.style.maxHeight === "undefined") {//if IE 6 48 jQuery("body","html").css({height: "100%", width: "100%"}); 49 jQuery("html").css("overflow","hidden"); 50 if (document.getElementById("TB_HideSelect") === null) {//iframe to hide select elements in ie6 51 jQuery("body").append("<iframe id='TB_HideSelect'>"+thickboxL10n.noiframes+"</iframe><div id='TB_overlay'></div><div id='TB_window' class='thickbox-loading'></div>"); 52 jQuery("#TB_overlay").on( 'click', tb_remove ); 53 } 54 }else{//all others 55 if(document.getElementById("TB_overlay") === null){ 56 jQuery("body").append("<div id='TB_overlay'></div><div id='TB_window' class='thickbox-loading'></div>"); 57 jQuery("#TB_overlay").on( 'click', tb_remove ); 58 jQuery( 'body' ).addClass( 'modal-open' ); 59 } 47 if(document.getElementById("TB_overlay") === null){ 48 jQuery("body").append("<div id='TB_overlay'></div><div id='TB_window' class='thickbox-loading'></div>"); 49 jQuery("#TB_overlay").on( 'click', tb_remove ); 50 jQuery( 'body' ).addClass( 'modal-open' ); 60 51 } 61 52 62 53 if(tb_detectMacXFF()){ … … 292 283 function tb_remove() { 293 284 jQuery("#TB_imageOff").off("click"); 294 285 jQuery("#TB_closeWindowButton").off("click"); 295 jQuery( '#TB_window' ).fadeOut( 'fast', function() {296 jQuery( '#TB_window, #TB_overlay , #TB_HideSelect' ).trigger( 'tb_unload' ).off().remove();286 jQuery( '#TB_window' ).fadeOut( 'fast', function() { 287 jQuery( '#TB_window, #TB_overlay' ).trigger( 'tb_unload' ).off().remove(); 297 288 jQuery( 'body' ).trigger( 'thickbox:removed' ); 298 289 }); 299 290 jQuery( 'body' ).removeClass( 'modal-open' ); 300 291 jQuery("#TB_load").remove(); 301 if (typeof document.body.style.maxHeight == "undefined") {//if IE 6302 jQuery("body","html").css({height: "auto", width: "auto"});303 jQuery("html").css("overflow","");304 }305 292 jQuery(document).off('.thickbox'); 306 293 return false; 307 294 } 308 295 309 296 function tb_position() { 310 var isIE6 = typeof document.body.style.maxHeight === "undefined";311 297 jQuery("#TB_window").css({marginLeft: '-' + parseInt((TB_WIDTH / 2),10) + 'px', width: TB_WIDTH + 'px'}); 312 if ( ! isIE6 ) { // take away IE6 313 jQuery("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'}); 314 } 298 jQuery("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'}); 315 299 } 316 300 317 301 function tb_parseQuery ( query ) { -
src/js/_enqueues/vendor/tinymce/skins/wordpress/wp-content.css
395 395 overflow-x: hidden; 396 396 } 397 397 398 .ie7 .gallery,399 .ie8 .gallery {400 margin: auto;401 }402 403 398 .gallery .gallery-item { 404 399 float: left; 405 400 margin: 0; … … 410 405 box-sizing: border-box; 411 406 } 412 407 413 .ie7 .gallery .gallery-item,414 .ie8 .gallery .gallery-item {415 padding: 6px 0;416 }417 418 408 .gallery .gallery-caption, 419 409 .gallery .gallery-icon { 420 410 margin: 0; … … 437 427 width: 33.333%; 438 428 } 439 429 440 .ie8 .gallery-columns-3 .gallery-item,441 .ie7 .gallery-columns-3 .gallery-item {442 width: 33%;443 }444 445 430 .gallery-columns-4 .gallery-item { 446 431 width: 25%; 447 432 } -
src/js/_enqueues/vendor/tinymce/plugins/wordpress/plugin.js
512 512 513 513 dom.setAttrib( doc.documentElement, 'lang', editor.getParam( 'wp_lang_attr' ) ); 514 514 515 if ( env.ie ) { 516 if ( parseInt( env.ie, 10 ) === 9 ) { 517 bodyClass.push('ie9'); 518 } else if ( parseInt( env.ie, 10 ) === 8 ) { 519 bodyClass.push('ie8'); 520 } else if ( env.ie < 8 ) { 521 bodyClass.push('ie7'); 522 } 523 } else if ( env.webkit ) { 515 if ( env.webkit ) { 524 516 bodyClass.push('webkit'); 525 517 } 526 518 -
src/js/_enqueues/wp/heartbeat.js
181 181 settings.minimalInterval = settings.minimalInterval * 1000; 182 182 } 183 183 184 /*185 * Switch the interval to 120 seconds by using the Page Visibility API.186 * If the browser doesn't support it (Safari < 7, Android < 4.4, IE < 10), the187 * interval will be increased to 120 seconds after 5 minutes of mouse and keyboard188 * inactivity.189 */184 /* 185 * Switch the interval to 120 seconds by using the Page Visibility API. 186 * If the browser doesn't support it (Safari < 7, Android < 4.4), the 187 * interval will be increased to 120 seconds after 5 minutes of mouse and keyboard 188 * inactivity. 189 */ 190 190 if ( typeof document.hidden !== 'undefined' ) { 191 191 hidden = 'hidden'; 192 192 visibilitychange = 'visibilitychange'; 193 193 visibilityState = 'visibilityState'; 194 } else if ( typeof document.msHidden !== 'undefined' ) { // IE10.195 hidden = 'msHidden';196 visibilitychange = 'msvisibilitychange';197 visibilityState = 'msVisibilityState';198 194 } else if ( typeof document.webkitHidden !== 'undefined' ) { // Android. 199 195 hidden = 'webkitHidden'; 200 196 visibilitychange = 'webkitvisibilitychange'; -
src/js/_enqueues/wp/emoji.js
28 28 // Private. 29 29 twemoji, timer, 30 30 loaded = false, 31 count = 0, 32 ie11 = window.navigator.userAgent.indexOf( 'Trident/7.0' ) > 0; 31 count = 0; 33 32 34 33 /** 35 34 * Detect if the browser supports SVG. … … 126 125 if ( ! node.parentNode ) { 127 126 continue; 128 127 } 129 130 if ( ie11 ) {131 /*132 * IE 11's implementation of MutationObserver is buggy.133 * It unnecessarily splits text nodes when it encounters a HTML134 * template interpolation symbol ( "{{", for example ). So, we135 * join the text nodes back together as a work-around.136 *137 * Node type 3 is a TEXT_NODE.138 */139 while( node.nextSibling && 3 === node.nextSibling.nodeType ) {140 node.nodeValue = node.nodeValue + node.nextSibling.nodeValue;141 node.parentNode.removeChild( node.nextSibling );142 }143 }144 145 128 node = node.parentNode; 146 129 } 147 130 -
src/js/_enqueues/wp/dashboard.js
199 199 * @return {void} 200 200 */ 201 201 function autoResizeTextarea() { 202 // When IE8 or older is used to render this document, exit.203 if ( document.documentMode && document.documentMode < 9 ) {204 return;205 }206 207 202 // Add a hidden div. We'll copy over the text from the textarea to measure its height. 208 203 $('body').append( '<div class="quick-draft-textarea-clone" style="display: none;"></div>' ); 209 204 … … 233 228 'display': 'none' 234 229 }); 235 230 236 // The 'propertychange' is used in IE < 9. 237 editor.on('focus input propertychange', function() { 231 editor.on('focus input', function() { 238 232 var $this = $(this), 239 233 // Add a non-breaking space to ensure that the height of a trailing newline is 240 234 // included. … … 422 416 423 417 requestParams = requestParams || {}; 424 418 requestParams._wpnonce = communityEventsData.nonce; 425 requestParams.timezone = window.Intl ? window.Intl.DateTimeFormat().resolvedOptions().timeZone : '';419 requestParams.timezone = Intl.DateTimeFormat().resolvedOptions().timeZone; 426 420 427 421 initiatedBy = requestParams.location ? 'user' : 'app'; 428 422 … … 675 669 * Prefer a name like `Europe/Helsinki`, since that automatically tracks daylight savings. This 676 670 * doesn't need to take `startTimestamp` into account for that reason. 677 671 */ 678 var timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone; 679 680 /* 681 * Fall back to an offset for IE11, which declares the property but doesn't assign a value. 682 */ 683 if ( 'undefined' === typeof timeZone ) { 684 /* 685 * It's important to use the _event_ time, not the _current_ 686 * time, so that daylight savings time is accounted for. 687 */ 688 timeZone = app.getFlippedTimeZoneOffset( startTimestamp ); 689 } 690 691 return timeZone; 672 return Intl.DateTimeFormat().resolvedOptions().timeZone; 692 673 }, 693 674 694 675 /** 695 * Get intuitive time zone offset.696 *697 * `Data.prototype.getTimezoneOffset()` returns a positive value for time zones698 * that are _behind_ UTC, and a _negative_ value for ones that are ahead.699 *700 * See https://stackoverflow.com/questions/21102435/why-does-javascript-date-gettimezoneoffset-consider-0500-as-a-positive-off.701 *702 * @since 5.5.2703 *704 * @param {number} startTimestamp705 *706 * @returns {number}707 */708 getFlippedTimeZoneOffset: function( startTimestamp ) {709 return new Date( startTimestamp ).getTimezoneOffset() * -1;710 },711 712 /**713 676 * Get a short time zone name, like `PST`. 714 677 * 715 678 * @since 5.5.2 … … 736 699 timeZoneAbbreviation = shortTimeStringParts[2]; 737 700 } 738 701 739 if ( 'undefined' === typeof timeZoneAbbreviation ) {740 /*741 * It's important to use the _event_ time, not the _current_742 * time, so that daylight savings time is accounted for.743 */744 var timeZoneOffset = app.getFlippedTimeZoneOffset( startTimestamp ),745 sign = -1 === Math.sign( timeZoneOffset ) ? '' : '+';746 747 // translators: Used as part of a string like `GMT+5` in the Events Widget.748 timeZoneAbbreviation = _x( 'GMT', 'Events widget offset prefix' ) + sign + ( timeZoneOffset / 60 );749 }750 751 702 return timeZoneAbbreviation; 752 703 }, 753 704 -
src/js/_enqueues/wp/customize/controls.js
8115 8115 populateChangesetUuidParam = function( isIncluded ) { 8116 8116 var urlParser, queryParams; 8117 8117 8118 // Abort on IE9 which doesn't support history management.8119 if ( ! history.replaceState ) {8120 return;8121 }8122 8123 8118 urlParser = document.createElement( 'a' ); 8124 8119 urlParser.href = location.href; 8125 8120 queryParams = api.utils.parseQueryString( urlParser.search.substr( 1 ) ); -
src/wp-admin/css/forms.css
362 362 text-shadow: 0 0 0 #0a4b78; 363 363 } 364 364 365 /* Remove background focus style from IE11 while keeping focus style available on option elements. */366 .wp-core-ui select::-ms-value {367 background: transparent;368 color: #50575e;369 }370 365 371 .wp-core-ui select:hover::-ms-value {372 color: #2271b1;373 }374 375 .wp-core-ui select:focus::-ms-value {376 color: #0a4b78;377 }378 379 .wp-core-ui select.disabled::-ms-value,380 .wp-core-ui select:disabled::-ms-value {381 color: #a7aaad;382 }383 384 /* Hide the native down arrow for select element on IE. */385 .wp-core-ui select::-ms-expand {386 display: none;387 }388 389 366 .wp-admin .button-cancel { 390 367 display: inline-block; 391 368 min-height: 28px; … … 695 672 min-height: 30px; 696 673 } 697 674 698 /* Hide the Edge "reveal password" native button */699 .wp-pwd input::-ms-reveal {700 display: none;701 }702 703 675 #pass1-text, 704 676 .show-password #pass1 { 705 677 display: none; 706 678 } 707 679 708 #pass1-text::-ms-clear {709 display: none;710 }711 712 680 .show-password #pass1-text { 713 681 display: inline-block; 714 682 } -
src/wp-content/themes/twentynineteen/js/touch-keyboard-navigation.js
43 43 } 44 44 45 45 /** 46 * Adds class to an element.47 *48 * @param {Object} el49 * @param {string} cls50 */51 function addClass(el, cls) {52 if ( ! el.className.match( '(?:^|\\s)' + cls + '(?!\\S)') ) {53 el.className += ' ' + cls;54 }55 }56 57 /**58 * Deletes class from an element.59 *60 * @param {Object} el61 * @param {string} cls62 */63 function deleteClass(el, cls) {64 el.className = el.className.replace( new RegExp( '(?:^|\\s)' + cls + '(?!\\S)' ),'' );65 }66 67 /**68 * Determines whether an element has the given class.69 *70 * @param {Object} el71 * @param {string} cls72 *73 * @returns {boolean} Has class74 */75 function hasClass(el, cls) {76 77 if ( el.className.match( '(?:^|\\s)' + cls + '(?!\\S)' ) ) {78 return true;79 }80 }81 82 /**83 46 * Toggles Aria Expanded state for screenreaders. 84 47 * 85 48 * @param {Object} ariaItem … … 107 70 'use strict'; 108 71 109 72 // Update classes. 110 // classList.add is not supported in IE11. 111 currentSubMenu.parentElement.className += ' off-canvas'; 112 currentSubMenu.parentElement.lastElementChild.className += ' expanded-true'; 73 currentSubMenu.parentElement.classList.add( 'off-canvas' ); 74 if ( currentSubMenu.parentElement.lastElementChild ) { 75 currentSubMenu.parentElement.lastElementChild.classList.add( 'expanded-true' ); 76 } 113 77 114 78 // Update aria-expanded state. 115 79 toggleAriaExpandedState( currentSubMenu ); … … 131 95 if ( getCurrentParent( currentSubMenu, 'ul' ).classList.contains( 'sub-menu' ) ) { 132 96 133 97 // Update classes. 134 // classList.remove is not supported in IE11. 135 menuItem.className = menuItem.className.replace( 'off-canvas', '' ); 136 subMenu.className = subMenu.className.replace( 'expanded-true', '' ); 98 menuItem.classList.remove( 'off-canvas' ); 99 if ( subMenu ) { 100 subMenu.classList.remove( 'expanded-true' ); 101 } 137 102 138 103 // Update aria-expanded and :focus states. 139 104 toggleAriaExpandedState( menuItemAria ); … … 142 107 } else { 143 108 144 109 // Update classes. 145 // classList.remove is not supported in IE11. 146 menuItem.className = menuItem.className.replace( 'off-canvas', '' ); 147 menuItem.lastElementChild.className = menuItem.lastElementChild.className.replace( 'expanded-true', '' ); 110 menuItem.classList.remove( 'off-canvas' ); 111 if ( menuItem.lastElementChild ) { 112 menuItem.lastElementChild.classList.remove( 'expanded-true' ); 113 } 148 114 149 115 // Update aria-expanded and :focus states. 150 116 toggleAriaExpandedState( menuItemAria ); … … 197 163 } 198 164 199 165 for ( o = 0; o < getFocusedClassElements.length; o++) { 200 deleteClass( getFocusedClassElements[o],'is-focused' );166 getFocusedClassElements[o].classList.remove( 'is-focused' ); 201 167 } 202 168 } 203 169 204 170 /** 205 * Matches polyfill for IE11.206 */207 if (!Element.prototype.matches) {208 Element.prototype.matches = Element.prototype.msMatchesSelector;209 }210 211 /**212 171 * Toggles `focus` class to allow sub-menu access on touch screens. 213 172 */ 214 173 function toggleSubmenuDisplay() { … … 252 211 253 212 var mainNav = getCurrentParent( event.target, '.main-navigation' ); 254 213 255 if ( null != mainNav && hasClass( mainNav, '.main-navigation' )) {214 if ( null != mainNav ) { 256 215 // Prevent default mouse events. 257 216 event.preventDefault(); 258 217 … … 284 243 var prevLi = getCurrentParent( event.target, '.main-navigation > div > ul > li', '.main-navigation' ).previousElementSibling; 285 244 var nextLi = getCurrentParent( event.target, '.main-navigation > div > ul > li', '.main-navigation' ).nextElementSibling; 286 245 287 if ( null !== focusedElement && null !== hasClass( focusedElement,focusedClass ) ) {288 deleteClass( focusedElement,focusedClass );246 if ( null !== focusedElement && focusedElement.classList.contains( focusedClass ) ) { 247 focusedElement.classList.remove( focusedClass ); 289 248 } 290 249 291 250 // Add .is-focused class to top-level li. 292 251 if ( getCurrentParent( event.target, '.main-navigation > div > ul > li', '.main-navigation' ) ) { 293 addClass( getCurrentParent( event.target, '.main-navigation > div > ul > li', '.main-navigation' ),focusedClass );252 getCurrentParent( event.target, '.main-navigation > div > ul > li', '.main-navigation' ).classList.add( focusedClass ); 294 253 } 295 254 296 255 // Check for previous li. 297 if ( prevLi && hasClass( prevLi,focusedClass ) ) {298 deleteClass( prevLi,focusedClass );256 if ( prevLi && prevLi.classList.contains( focusedClass ) ) { 257 prevLi.classList.remove( focusedClass ); 299 258 } 300 259 301 260 // Check for next li. 302 if ( nextLi && hasClass( nextLi,focusedClass ) ) {303 deleteClass( nextLi,focusedClass );261 if ( nextLi && nextLi.classList.contains( focusedClass ) ) { 262 nextLi.classList.remove( focusedClass ); 304 263 } 305 264 } 306 265 -
src/wp-content/themes/twentynineteen/js/priority-menu.js
56 56 * @param {Element} element 57 57 */ 58 58 function showButton(element) { 59 // classList.remove is not supported in IE11. 60 element.className = element.className.replace('is-empty', ''); 59 element.classList.remove( 'is-empty' ); 61 60 } 62 61 63 62 /** … … 66 65 * @param {Element} element 67 66 */ 68 67 function hideButton(element) { 69 // classList.add is not supported in IE11. 70 if (!element.classList.contains('is-empty')) { 71 element.className += ' is-empty'; 72 } 68 element.classList.add( 'is-empty' ); 73 69 } 74 70 75 71 /** -
src/wp-content/themes/twentytwentyone/functions.php
391 391 * 392 392 * @since Twenty Twenty-One 1.0 393 393 * 394 * @global bool $is_IE395 * @global WP_Scripts $wp_scripts396 *397 394 * @return void 398 395 */ 399 396 function twenty_twenty_one_scripts() { 400 // Note, the is_IE global variable is defined by WordPress and is used 401 // to detect if the current browser is internet explorer. 402 global $is_IE, $wp_scripts; 403 if ( $is_IE ) { 404 // If IE 11 or below, use a flattened stylesheet with static values replacing CSS Variables. 405 wp_enqueue_style( 'twenty-twenty-one-style', get_template_directory_uri() . '/assets/css/ie.css', array(), wp_get_theme()->get( 'Version' ) ); 406 } else { 407 // If not IE, use the standard stylesheet. 408 wp_enqueue_style( 'twenty-twenty-one-style', get_template_directory_uri() . '/style.css', array(), wp_get_theme()->get( 'Version' ) ); 409 } 397 wp_enqueue_style( 'twenty-twenty-one-style', get_template_directory_uri() . '/style.css', array(), wp_get_theme()->get( 'Version' ) ); 410 398 411 399 // RTL styles. 412 400 wp_style_add_data( 'twenty-twenty-one-style', 'rtl', 'replace' ); … … 419 407 wp_enqueue_script( 'comment-reply' ); 420 408 } 421 409 422 // Register the IE11 polyfill file.423 wp_register_script(424 'twenty-twenty-one-ie11-polyfills-asset',425 get_template_directory_uri() . '/assets/js/polyfills.js',426 array(),427 wp_get_theme()->get( 'Version' ),428 array( 'in_footer' => true )429 );430 431 // Register the IE11 polyfill loader.432 wp_register_script(433 'twenty-twenty-one-ie11-polyfills',434 null,435 array(),436 wp_get_theme()->get( 'Version' ),437 array( 'in_footer' => true )438 );439 wp_add_inline_script(440 'twenty-twenty-one-ie11-polyfills',441 wp_get_script_polyfill(442 $wp_scripts,443 array(444 'Element.prototype.matches && Element.prototype.closest && window.NodeList && NodeList.prototype.forEach' => 'twenty-twenty-one-ie11-polyfills-asset',445 )446 )447 );448 449 410 // Main navigation scripts. 450 411 if ( has_nav_menu( 'primary' ) ) { 451 412 wp_enqueue_script( 452 413 'twenty-twenty-one-primary-navigation-script', 453 414 get_template_directory_uri() . '/assets/js/primary-navigation.js', 454 array( 'twenty-twenty-one-ie11-polyfills'),415 array(), 455 416 wp_get_theme()->get( 'Version' ), 456 417 array( 457 418 'in_footer' => false, // Because involves header. … … 464 425 wp_enqueue_script( 465 426 'twenty-twenty-one-responsive-embeds-script', 466 427 get_template_directory_uri() . '/assets/js/responsive-embeds.js', 467 array( 'twenty-twenty-one-ie11-polyfills'),428 array(), 468 429 wp_get_theme()->get( 'Version' ), 469 430 array( 'in_footer' => true ) 470 431 ); -
src/wp-content/themes/twentytwentyone/assets/js/polyfills.js
1 /**2 * File polyfills.js.3 *4 * Polyfills for IE11.5 */6 7 /**8 * Polyfill for Element.closest() because we need to support IE11.9 *10 * @since Twenty Twenty-One 1.011 *12 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/closest13 */14 if ( ! Element.prototype.matches ) {15 Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;16 }17 18 if ( ! Element.prototype.closest ) {19 Element.prototype.closest = function( s ) {20 var el = this;21 do {22 if ( Element.prototype.matches.call( el, s ) ) {23 return el;24 }25 el = el.parentElement || el.parentNode;26 } while ( el !== null && el.nodeType === 1 );27 return null;28 };29 }30 31 /**32 * Polyfill for NodeList.foreach() because we need to support IE11.33 *34 * @since Twenty Twenty-One 1.035 *36 * @see https://developer.mozilla.org/en-US/docs/Web/API/NodeList/forEach37 */38 if ( window.NodeList && ! NodeList.prototype.forEach ) {39 NodeList.prototype.forEach = function( callback, thisArg ) {40 var i;41 thisArg = thisArg || window;42 for ( i = 0; i < this.length; i++ ) {43 callback.call( thisArg, this[i], i, this );44 }45 };46 }