[OpenLayers-Users] potential big IE performance enhancement- help!

Andreas Hocevar ahocevar at opengeo.org
Tue May 18 14:48:48 EDT 2010


On May 18, 2010, at 19:21 , mortac8 wrote:

> 
> That actually seems a bit slower :(
> 2:59- to render my layer setting node.style.display="none"; then
> node.style.display=""; 
> 2:42- the original way
> 
> I don't understand why setting node.style.cssText is different than
> node.style.  Can you explain it briefly?  I ask because the simple example
> below seems to work as I'd expect VML.js:setStyle to work.

Because cssText is meant to set css on a CSS rule, not on a style. In IE, however, it works on styles (presumably accidently, and not very well). See the 2nd usage caveat on http://msdn.microsoft.com/en-us/library/ms533698(VS.85).aspx

You could try node.cssText instead of node.style.cssText. Wouldn't surprise me if that would do the trick.

Regards,
Andreas.


> 
> Thanks again!
> Ashley
> 
> <html>
> <body>
>   <div
> style="left:50px;top:50px;width:800px;height:600px;background-color:gray;">
>   </div>
>   <div id="target"
> style="position:absolute;width:5px;height:5px;left:100px;top:75px;background-color:red;"></div>
> <script type="text/javascript">
>   var t = document.getElementById("target");
>   var top = 300;
>   var left = 400;
>   setInterval(move, 750);
>   function move() {
>       top=Math.floor(Math.random()*600);
>       left=Math.floor(Math.random()*800);
> 
> t.style.cssText="position:absolute;width:5px;height:5px;background-color:red;top:"
> + top + "px;left:" + left + "px;";
>   }
> </script>
> </body>
> </html>
> 
> 
> 
> Andreas Hocevar-2 wrote:
>> 
>> Hi,
>> 
>> setting cssText is not the same as setting the style. But you could
>> instead try to call
>> 
>> node.style.display = "none";
>> 
>> as first line of the setStyle method, and
>> 
>> node.style.display = "";
>> 
>> as last line of the setStyle method.
>> 
>> Let us know if this also boosts performance.
>> 
>> Good luck,
>> Andreas.
>> 
>> 
> 
> -- 
> View this message in context: http://osgeo-org.1803224.n2.nabble.com/potential-big-IE-performance-enhancement-help-tp5070709p5071123.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users

-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.




More information about the Users mailing list