[OpenLayers-Dev] Re: [OpenLayers-Users] VML.js and IE's 31 style
sheet limit
Tim Schaub
tschaub at opengeo.org
Wed Mar 9 11:12:50 EST 2011
Hey Jeff-
I think the proposed solution below makes sense. Could you create a
ticket for this? If you can also create a patch, that would get this
one step closer.
http://trac.osgeo.org/openlayers/wiki/HowToContribute
Thanks,
Tim
On 3/8/11 10:27 AM, Jeff Dege wrote:
> 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
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
--
Tim Schaub
OpenGeo - http://opengeo.org
Expert service straight from the developers.
More information about the Dev
mailing list