Index: trunk/phase3/resources/mediawiki/mediawiki.js |
— | — | @@ -375,7 +375,7 @@ |
376 | 376 | |
377 | 377 | /* Private methods */ |
378 | 378 | |
379 | | - function getMarker(){ |
| 379 | + function getMarker() { |
380 | 380 | // Cached ? |
381 | 381 | if ( $marker ) { |
382 | 382 | return $marker; |
— | — | @@ -389,6 +389,27 @@ |
390 | 390 | return $marker; |
391 | 391 | } |
392 | 392 | } |
| 393 | + |
| 394 | + function addInlineCSS( css, media ) { |
| 395 | + var $style = getMarker().prev(); |
| 396 | + if ( $style.is( 'style' ) && $style.data( 'ResourceLoaderDynamicStyleTag' ) === true ) { |
| 397 | + // There's already a dynamic <style> tag present, append to it |
| 398 | + // This recycling of <style> tags is for bug 31676 (can't have |
| 399 | + // more than 32 <style> tags in IE) |
| 400 | + |
| 401 | + // Do cdata sanitization on the provided CSS, and prepend a double newline |
| 402 | + css = $( mw.html.element( 'style', {}, new mw.html.Cdata( "\n\n" + css ) ) ).html(); |
| 403 | + $style.append( css ); |
| 404 | + } else { |
| 405 | + // Create a new <style> tag and insert it |
| 406 | + $style = $( mw.html.element( 'style', { |
| 407 | + 'type': 'text/css', |
| 408 | + 'media': media |
| 409 | + }, new mw.html.Cdata( css ) ) ); |
| 410 | + $style.data( 'ResourceLoaderDynamicStyleTag', true ); |
| 411 | + getMarker().before( $style ); |
| 412 | + } |
| 413 | + } |
393 | 414 | |
394 | 415 | function compare( a, b ) { |
395 | 416 | var i; |
— | — | @@ -686,10 +707,7 @@ |
687 | 708 | } ) ); |
688 | 709 | } |
689 | 710 | } else if ( typeof style === 'string' ) { |
690 | | - getMarker().before( mw.html.element( 'style', { |
691 | | - 'type': 'text/css', |
692 | | - 'media': media |
693 | | - }, new mw.html.Cdata( style ) ) ); |
| 711 | + addInlineCSS( style, media ); |
694 | 712 | } |
695 | 713 | } |
696 | 714 | } |
Index: trunk/phase3/RELEASE-NOTES-1.19 |
— | — | @@ -245,6 +245,8 @@ |
246 | 246 | * It is now possible to delete images that have no corresponding description pages. |
247 | 247 | * (bug 33165) GlobalFunctions.php line 1312: Call to a member function |
248 | 248 | getText() on a non-object |
| 249 | +* (bug 31676) Group dynamically inserted CSS into a single <style> tag, to work |
| 250 | + around a bug where not all styles were applied in Internet Explorer |
249 | 251 | |
250 | 252 | === API changes in 1.19 === |
251 | 253 | * Made action=edit less likely to return "unknownerror", by returning the actual error |