4 ms·
>The root of the limitations is that Internet Explorer uses a 32bit integer to identify, sort, and apply the cascading rules. The integer’s 32bits are split int
by ntkachov 13y ago
>The root of the limitations is that Internet Explorer uses a 32bit integer to identify, sort, and apply the cascading rules. The integer’s 32bits are split into five fields: four sheetIDs of 5 bits each, and one 12bit ruleID
Is there a reason for this? Why not just use 3 shorts?
- seabee 13y agoIs there a reason for 3 shorts? Why not use a 64-bit integer, etc. There is always some level of arbitrariness when you represent data structures this way for performance reasons. It's all about what maximum values you think are good enough.
- Tloewald 13y agoPresumably this also leads to an upper limit on the number of stylesheets.
- ArtDev 13y agoIts 32.
- userbinator 13y agoBecause a single integer is much faster and easier to operate on than 3 separate pieces, and doing a single array sort to compute cascade order is a great idea because of how simple it is. It seems they didn't expand the limits to 64-bit, as that could vastly increase them: e.g. a (5x4):24 split, meaning 16M rules per sheet.... and if you have 16 million rules in a single CSS file, I think it's safe to say the CSS rule limit is the least of your problems. (But then whoever came up with the 4K limit probably thought the same thing...!) Does anyone happen to know what WebKit/Gecko/Presto does? I've been thinking of writing my own HTML/CSS layout engine and these sorts of things make for interesting decisions on the algorithms to use.