Also leave a comment on the line where the relevant exception
will be thrown from if it does end up hitting the limit still
(which wouldn't be due to mw.loader appending more than 31
stylesheets but due to there being more than 30 on the page
already).
Change-Id: I3a46affc5498fbaa1d442ca65cb4844dd8f8169c
- // By default, always create a new <style>. Appending text
- // to a <style> tag means the contents have to be re-parsed (bug 45810).
- // Except, of course, in IE below 9, in there we default to
- // re-using and appending to a <style> tag due to the
- // IE stylesheet limit (bug 31676).
+ // By default, always create a new <style>. Appending text to a <style>
+ // tag is bad as it means the contents have to be re-parsed (bug 45810).
+ //
+ // Except, of course, in IE 9 and below. In there we default to re-using and
+ // appending to a <style> tag due to the IE stylesheet limit (bug 31676).
if ( 'documentMode' in document && document.documentMode <= 9 ) {
$style = getMarker().prev();
if ( 'documentMode' in document && document.documentMode <= 9 ) {
$style = getMarker().prev();
*/
function addLink( media, url ) {
var el = document.createElement( 'link' );
*/
function addLink( media, url ) {
var el = document.createElement( 'link' );
- getMarker().before( el ); // IE: Insert in dom before setting href
+ // For IE: Insert in document *before* setting href
+ getMarker().before( el );
el.rel = 'stylesheet';
if ( media && media !== 'all' ) {
el.media = media;
}
el.rel = 'stylesheet';
if ( media && media !== 'all' ) {
el.media = media;
}
+ // If you end up here from an IE exception "SCRIPT: Invalid property value.",
+ // see #addEmbeddedCSS, bug 31676, and bug 47277 for details.