function loadCSS( cssUrl, currentLink ) {
	return new Promise( resolve => {
		const link = document.createElement( 'link' );
		link.rel = 'stylesheet';
		link.type = 'text/css';
		link.href = cssUrl;

		if ( 'onload' in link ) {
			link.onload = () => {
				link.onload = null;
				resolve( link );
			};
		} else {
			// just wait 500ms if the browser doesn't support link.onload
			// https://pie.gd/test/script-link-events/
			// https://github.com/ariya/phantomjs/issues/12332
			setTimeout( () => resolve( link ), 500 );
		}

		document.head.insertBefore( link, currentLink ? currentLink.nextSibling : null );
	} );
}
function loadCSS( cssUrl, currentLink ) {
	return new Promise( resolve => {
		const link = document.createElement( 'link' );
		link.rel = 'stylesheet';
		link.type = 'text/css';
		link.href = cssUrl;

		if ( 'onload' in link ) {
			link.onload = () => {
				link.onload = null;
				resolve( link );
			};
		} else {
			
			
			
			setTimeout( () => resolve( link ), 500 );
		}

		document.head.insertBefore( link, currentLink ? currentLink.nextSibling : null );
	} );
}
function loadCSS ( cssUrl , currentLink ) { return new Promise ( resolve => { const link = document . createElement ( 'link' ) ; link . rel = 'stylesheet' ; link . type = 'text/css' ; link . href = cssUrl ; if ( 'onload' in link ) { link . onload = ( ) => { link . onload = null ; resolve ( link ) ; } ; } else { // just wait 500ms if the browser doesn't support link.onload // https://pie.gd/test/script-link-events/ // https://github.com/ariya/phantomjs/issues/12332 setTimeout ( ( ) => resolve ( link ) , 500 ) ; } document . head . insertBefore ( link , currentLink ? currentLink . nextSibling : null ) ; } ) ; }
Loads a CSS stylesheet into the page.

@param {string} cssUrl URL of a CSS stylesheet to be loaded into the page
@param {Element} currentLink an existing <link> DOM element before which we want to insert the new one
@returns {Promise<String>} the new <link> DOM element after the CSS has been loaded
Loads a CSS stylesheet into the page .