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

Polet Guillaume guillaume.polet at trasys.be
Wed May 26 06:06:46 EDT 2010


Probably a dumb thought but why not using directly:

node.style="width:18px;height:18px;top:10px;left:10px;";


Guillaume


 

-----Original Message-----
From: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org]
On Behalf Of Andreas Hocevar
Sent: 18 May 2010 20:49
To: mortac8
Cc: users at openlayers.org
Subject: Re: [OpenLayers-Users] potential big IE performance
enhancement-help!

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;backgr
ound-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-enha
ncement-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.

_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users
 



More information about the Users mailing list