[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
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.0 11 * 12 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/closest 13 */ 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.0 35 * 36 * @see https://developer.mozilla.org/en-US/docs/Web/API/NodeList/forEach 37 */ 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 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated : Sun Dec 22 08:20:01 2024 | Cross-referenced by PHPXref |