Skip to content

Another weird IE6 (and 7 and 8) bug

Old content alert!

Thanks very much for visiting my blog. Always happy to have people read my stuff but just thought I should point out this post is years old. If it's about technical stuff there is a possibility that it is no longer relevant, if it's a bug report/fix I'm hoping that it should now have been fixed.

Of course if this is what you're looking for and it does work then great, just don't say I didn't warn you...

This morning I saw an email going around the LBi mailing list from one of the application developers mentioning some weird behavior noticed in IE.

In a nutshell a load of CSS modules had been concatenated into one file leading to quite a large number of selectors being used. He found that after a certain point (4096 selectors) IE would ignore everything after it. I had never heard of this before and from reading some comments I got on Twitter a few other folk hadn’t either…

My boss found this online which would hint to it being this being true – but this being a DOM method I wanted to make sure the same went for the CSS parser.

After a chat with Stuart Langridge (who provided me with a useful python script to make the file) I have a use case and confirm this bug does indeed exist in IE – even in IE8.

Scroll down to the bottom of this iFrame (make sure you’re using IE) and you’ll see the final 5 ‘OK’s are in the default of black and not red as they should be styled! If you’re not a fan of iFrames it’s also availiable as an external link – IE 4096 selector usecase.

In additional news IE will also bork when presented with more than 32 @import statements ( so in many ways if you have a shed load of CSS you’re damned if you do and damned if you don’t!

  • Robert

    also I just tested this with IE 9 and the last 5 are black so MS has not fixed this issue at all.

  • Chiangmaiplaces comnet

    No solution in IE9 neither ? This is crazy!
    What’s the solution then ? Splitting the file every 4096 selectors ? It’s a bit a pain in the ass if you want to automate the process :(