Hello,
Wouldn't this break the code for NS4?
P.S. DynLayer.prototype.getValues is a common name for
an internal method. Some custome widgets might be
using getValues() as a method. I think _getValues()
might be more unique.
--
Raymond
--- Richard Bennett <[EMAIL PROTECTED]> wrote:
> Hi,
> While making a more powerful tree-view code, I was
> making a Litelayer, that
> doesn't have any events etc, but renders much
> faster, and I noticed that
> there is a way to speed up the initial creation of
> dynlayers too.
>
> I got it working on browsers supporting
> getElementById only, others remain
> at the same speed (although document.all should work
> too)
>
> What it is, is if you remove these lines from
> specificCreate():
> //
>
this.elm=parentElement.children[parentElement.children.length-1];
> // this.css=this.elm.style;
> // this.doc=this.parent.doc;
>
> the rendering of 1000 layers goes from 8.6 seconds
> to 5.4 seconds. (the
> liteLayer does it in 3.7 sec)
>
> the more layers, the bigger the difference.
>
> Now of course we need this.elm to be set, but only
> if we are going to
> manipulate a layer. So, if we add something like
> this:
>
> DynLayer.prototype.getValues=function() {
> if(document.getElementById) {
> this.elm=document.getElementById(this.id)
> if(this.elm){
> this.css=this.elm.style;
> this.doc=this.parent.doc;
> this.css.zIndex=this.z;
>
> this.frame=this.parent.frame
> this.elm.lyrobj=this;
> return true
> }else{
> return false
> }
> }
> }
>
> this would set the this.elm variable, if it hasn't
> been set, and return true
> or false, depending on whether the object had been
> created yet.
>
> so in places that now contain the check:
>
> if (this.css==null) return;
> or
> if (this.elm==null) return;
>
> we could do this:
> if (this.getValues()==false) return;
>
> The whole thing means code like this:
>
> myDynLayer = new
> DynLayer(null,50,35,300,30,"yellow")
> myDynLayer.setHTML("hi")
> DynAPI.document.addChild(myDynLayer)
>
> would render faster than code like this:
>
> myDynLayer = new
> DynLayer(null,50,35,300,30,"yellow")
> DynAPI.document.addChild(myDynLayer)
> myDynLayer.setHTML("hi")
>
> Does anyone see any problems in this approach?
>
> Cheers,
> Richard.
> www.richardinfo.com
>
>
>
> _______________________________________________
> Dynapi-Dev mailing list
> [EMAIL PROTECTED]
>
http://www.mail-archive.com/[email protected]/
__________________________________________________
Do You Yahoo!?
Make a great connection at Yahoo! Personals.
http://personals.yahoo.com
_______________________________________________
Dynapi-Dev mailing list
[EMAIL PROTECTED]
http://www.mail-archive.com/[email protected]/