6 ms·
All style tags after the first 30 style tags are not applied in IE (4-8)
- nkohari 17y agoI would never defend Internet Explorer, but I don't think this is really a big deal. If you have more than 30 style tags on any page, something is very wrong. IE has plenty of bugs and limitations that are much worse than this. :)
- duckuu 17y agoYeah, I agree with you. But think about it, if we have so many style tags in a single page, we did it bad. If IE has this stupid limitation, they did it bad.
- jsdalton 17y agoSomeone brought this point up on proggit, and it was debunked by someone else who pointed out that many developers break their stylesheets up into multiple components for development purposes and then compile and compress them for production. This bug prevents them from testing on IE effectively. Genghis Khan might have had far worse faults than picking his nose at the dinner table, but that still doesn't excuse the behavior.
- wsbail29 17y agoIt's true that more than 30 style tags on a production application is a big problem; however, in development mode it can be useful for debugging and maintainability to break out your stylesheets into granular modules that get concatenated at deploy time. I've personally bumped into this limit in IE in development mode. My solution was to build a dynamic method that concatenated all the stylesheets on the fly if the IE user agent was detected.
- Semiapies 17y agoHmm, odd limit. I've never had more than 5 style tags on a page, though, and fewer since I got into using yuicompressor. Has anyone here actually run into this in practice? If so, how? Just curious.
- n8agrin 17y agoCreate a modular UI framework that allows modules to import their own stylesheets. You hit this problem really quickly.
- deleted 17y ago[deleted]
- deleted 17y ago[deleted]
- qeorge 17y agoPerhaps, but if you're including 30+ stylesheets in a given page you're doing it wrong. Every stylesheet is an extra (blocking) HTTP request. 5 is already too many, but 30 is seriously impacting your user's experience.
- DrJokepu 17y agoThis bug can be triggered by inline stylesheets as well which do not create additional HTTP requests.
- qeorge 17y agoFair point, but in what case does including 30 inline stylesheets make sense? I'm hesitant to call this a bug.
- pavs 17y agoWell, with MS, its a feature.
- dkarl 17y agoAt MS, it might be dictated by a coding standard. More seriously, I was once treated VERY skeptically by an old-school programmer (not at MS, never worked there) when I replaced some of his fixed-sized buffers with resizeable ones. "If our customers are running workloads that create more than 256 frooble node objects, I want to hear about it." Via a bug report? Really? And then get a new bug report next year when the new limit is reached? But he was adamant, and if it was up to him we wouldn't have made the change at all. The way he worked, you knew how many frooble node objects the customer needed, and if you were wrong then you fixed the code.
- deleted 17y ago[deleted]
- deleted 17y ago[deleted]
- hackworth 17y agoalso important to note: each stylesheet cannot have more than 4095 CSS rules, in IE. experiencing this limit makes for some mighty interesting debugging.
- billybob 17y agoIf you've got a stylesheet with more than 4095 rules, I bet you have some interesting debugging anyway.
- callahad 17y agoIt's not that unreasonable. Scenario: You download the Fugue icon set (http://www.pinvoke.com/ http://www.pinvoke.com/). You're working on a template, and want to be able to quickly try out different icons in different places. If you generate two rules for each of the 2500 icons, you're over the limit.
- chaosmachine 17y agoAnyone want to guess why the number is 30?
- matthavener 17y agoSomewhere in Redmond, WA PageStyleTagsW tags[ Thinks for 5 seconds PageStyleTagsW tags[30]; /* should be enough for any page / Goes and gets a free soda* Sometimes imposing arbitrary limits in C is a lot easier than manually managing dynamic memory in the heap..
- alttab 17y agoI've seen this where I work all the time. I've also seen code where the developer created 25 different structures named structure_type_X where X is 1-25, the size of the structure's internal buffer. How do you deal with 25 different structure types with nothing different but the name and buffer size? Why, a switch statement of course...
- CamperBob 17y agoIt's pretty common for Verilog developers to think they're writing C code, but that's the first time I've heard the converse.
- alttab 17y agoThe guy does some pretty interesting stuff - writes scripts to automatically generate structures so class variables are byte aligned and within cache lines and all that. But he has made some of the dumbest use of C++ I have ever seen. Verbs as classes, sometimes making it obvious that inheritance escapes him, and an entire cpp file over 10k lines long that does nothing but assert the mass amount of assumptions his code makes. The one method is literally called 'check_assumptions.' I'm not bitter though.
- bradtgmurray 17y agoSounds like a problem for C++ templates.
- DrJokepu 17y agoThe fact that 30 is suspiciously close to 32 makes the impression that there's some unholy C black magic in the background of the bug. I wish programmers stopped doing stuff like that unless they really have to.
- pwmanagerdied 17y agoHuh. A five bit range would give a max of 31, and if we assume that the default/built-in stylesheet knocks another off, that's 30. I agree with you, though I think I'd prefer this to hint at the reason over it being an entirely arbitrary descision. Making such a choice for a bad reason is still preferable to making it for no reason.
- kingkilr 17y agoYeah, I'm hoping it's that. Purely arbitrary would just be... stupid.
- Periodic 17y agostruct Element { // Update: apparently 16 wasn't enough. Raised to 30 to pass test #452 StyleData styles[30]; // No one uses more than 16 style parameters anyway. }
- wheels 17y agoIt may be a sanity check; often when writing parsers for "in the wild" data you have to pick a cutoff for where "doesn't make sense" is so that you can tell if you're looking at junk data and stop trying to make sense of it (and the RAM / CPU entailed in such).
- Empact 17y agoThis is what happens when you work at a company which doesn't have the sense and engineering leadership to arrive at a single core set of collections and such ala CoreFoundation: http://developer.apple.com/mac/library/documentation/CoreFoundation/Reference/CoreFoundation_Collection/index.html http://developer.apple.com/mac/library/documentation/CoreFou... Microsoft has a hodge podge of several attempts at the same, and because none is truly core and universally available, it's quite easy to be ignorant of what's available and roll your own crappy, limited data structures.
- samlittlewood 17y agoOuch, I always try to make limits be 0, 1 or many - where 'many' is the limit of physical resources.
- snprbob86 17y agoA motivated, well documented, and standardized limit is sometimes appropriate. This is not one of those times.
- deleted 17y ago[deleted]
- deleted 17y ago[deleted]
- archon810 17y agoI'm assuming this doesn't include the inline style="" params and only includes <style> tags. At first, I thought it did and didn't believe such a limitation went unnoticed by many for so long.
- pyre 17y agoThe inline style params are called attributes. Anything within the tag itself -- of form token="value" -- is called an attribute (unless there is some arcane SGML or HTML structure that I'm missing).
- deleted 17y ago[deleted]
- merrychristmas 17y agohttp://www.wowowbiz.com http://www.wowowbiz.com The website wholesale for many kinds of fashion shoes, like the nike,jordan,prada,adidas, also including the jeans,shirts,bags,hat and the decorations. All the products are free shipping, and the the price is competitive, and also can accept paypal payment.,after the payment, can ship within short time. free shipping competitive price any size available our price: jordan air max oakland raiders $34--39; Ed Hardy AF JUICY POLO Bikini $25; Christan Audigier BIKINI JACKET $25; gstar coogi evisu true jeans $35; coach chanel gucci LV handbags $36; coogi DG edhardy gucci t-shirts $18; CA edhardy vests.paul smith shoes $32; jordan dunk af1 max gucci shoes $37; EDhardy gucci ny New Era cap $16; coach okely Adidas CHANEL DG Sunglass $18; We do wholesale and retail! All are extremely CHEAP, please visit:http://www.wowowbiz.com http://www.wowowbiz.com Thank you for your visit
- merrychristmas 17y agohttp://www.wowowbiz.com http://www.wowowbiz.com The website wholesale for many kinds of fashion shoes, like the nike,jordan,prada,adidas, also including the jeans,shirts,bags,hat and the decorations. All the products are free shipping, and the the price is competitive, and also can accept paypal payment.,after the payment, can ship within short time. free shipping competitive price any size available our price: jordan air max oakland raiders $34--39; Ed Hardy AF JUICY POLO Bikini $25; Christan Audigier BIKINI JACKET $25; gstar coogi evisu true jeans $35; coach chanel gucci LV handbags $36; coogi DG edhardy gucci t-shirts $18; CA edhardy vests.paul smith shoes $32; jordan dunk af1 max gucci shoes $37; EDhardy gucci ny New Era cap $16; coach okely Adidas CHANEL DG Sunglass $18; We do wholesale and retail! All are extremely CHEAP, please visit:http://www.wowowbiz.com http://www.wowowbiz.com Thank you for your visit
- timdorr 17y agoAnd I love the link at the top (when not viewing the page in IE): Upgrade your Internet Experience. Which links to IE, of course.
- cmgarcia 17y agoI laughed hysterically when I saw that at the top after reading the first few lines of the kb article.
- billybob 17y ago"Resolution: To work around this limitation, combine multiple classes into a single style tag." Um... don't they mean multiple styles into a single class tag?
- jeroen 17y agoNo. What they mean is combining <style> .class1 { .. } </style> <style> .class2 { .. } </style> into <style> .class1 { .. } .class2 { .. } </style>
- MrMatt 17y agoI've hit this problem before - I use a separate stylesheet for each logical (in my mind) group of styles - header, footer, main content, blog, and so on. This way, I only have a few styles in each file, and it's easier for me to manage (YMMV). I only combine them into a single stylesheet on production and staging. It's annoying to have to run the stylesheet combine when testing as when I find problems, I have to sort through a mass of css and rerun the combiner in order to test fixes. OR http://www.i-marco.nl/weblog/archive/2006/06/24/time_breakdown_of_modern_web_d http://www.i-marco.nl/weblog/archive/2006/06/24/time_breakdo... (But without the red section).
- jackmanbob 17y agoThis is a silly problem for IE to have for sure (not that anyone's surprised), but really... if you are using more than 30 <style> tags, then you've likely got some fundamental design/architecture issues to begin with.
- bengtan 17y agoDrupal's discussion of this (and with a workaround, I vaguely remember) ... http://drupal.org/node/256802 http://drupal.org/node/256802
- jamesjyu 17y agoThis problem can be avoided by using @import statements within each style tag to import more than 30 stylesheets. Some discussion here: http://drupal.org/node/228818 http://drupal.org/node/228818 Of course, you should avoid doing this in production anyway, and just asset package your stylesheets into very few stylesheets. I've made a fork of the asset_packager project to support this behavior after 31 stylesheets: http://github.com/jamesyu/asset_packager_ie_css_limit http://github.com/jamesyu/asset_packager_ie_css_limit
- danw 17y agoThere's a limit to the number of @import's you can have per style tag too, but the imported stylesheets can also include @import's, from what I remember.