IE has a limit of 31 style sheets, whether created with <style>, <link>, or
document.createStyleSheet.
Of course, most folks will implement some sort of style sheet merging and
minifying mechanism in production, because too many style sheets is a
performance killer, but keeping separate style sheets can make development
easier.
We have a page that is hitting the limit, and the error is occurring in the VML
renderer of a Vector Layer.
OpenLayers.Renderer.VML.intialize() contains:
var style = document.createStyleSheet();
And this throws an exception, if there are already 31 style sheets on the page.
Browsing around on the issue led me to this blog entry:
http://dean.edwards.name/weblog/2010/02/bug85/
Comment 15 says that he avoids the error by appending his new style rules to
the last style sheet object, when creating a new one throws an error:
var sheet = null;
try {
sheet = document.createStyleSheet ();
sheet.cssText = cssText;
} catch (e) {
sheet = document.styleSheets[document.styleSheets.length - 1];
sheet.cssText += "\r\n" + cssText;
}
I'm wondering if this might be a good idea in OpenLayers.
Thoughts?
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users