+
+ function addInlineCSS( css, media ) {
+ var $style = getMarker().prev();
+ if ( $style.is( 'style' ) && $style.data( 'ResourceLoaderDynamicStyleTag' ) === true ) {
+ // There's already a dynamic <style> tag present, append to it
+ // This recycling of <style> tags is for bug 31676 (can't have
+ // more than 32 <style> tags in IE)
+
+ // Do cdata sanitization on the provided CSS, and prepend a double newline
+ css = $( mw.html.element( 'style', {}, new mw.html.Cdata( "\n\n" + css ) ) ).html();
+ $style.append( css );
+ } else {
+ // Create a new <style> tag and insert it
+ $style = $( mw.html.element( 'style', {
+ 'type': 'text/css',
+ 'media': media
+ }, new mw.html.Cdata( css ) ) );
+ $style.data( 'ResourceLoaderDynamicStyleTag', true );
+ getMarker().before( $style );
+ }
+ }