Just to clarify a couple of things, here's how new Element works:

1. we use document.createElement the first time its called, extend the
generated element and cache it.
2. when you create a second element with the same tag name, we just
clone the cached element.

The IE "technique" you are referring to is just a special casing for
IE 's poor handling of the name attribute.

Hope this helps,

Regards,

Tobie




2. we store a cloned Extended version of t
On Aug 9, 8:06 am, Tom Gregory <[EMAIL PROTECTED]> wrote:
> It would. Although again I disagree with your conclusion as to why.  
> (But it does reinforce my previous assertion that most of the  
> slowdown you were seeing was due to element creation.)
>
> The prototype DOM builder uses a technique unique to IE to create the  
> elements (in IE only), which (being similar to the innerHTML solution  
> which has been proven to be decently fast in IE), is much faster than  
> document.createElement.
>
> I don't buy the "slowness caused by extending" argument, because a)  
> it didn't go away in your new test, and yet you saw speedup, and b)  
> Prototype's DOM builder (i.e. new Element) extends elements too.
>
> Oh, ... and there are too many Tom's on this thread.  Some of you  
> will have to change your name.  =)
>
> TAG
>
> On Aug 9, 2007, at 1:05 AM, Tom wrote:
>
> > I believe the slowness is caused by the speed (or lack thereof) of
> > extending each element during the call to Event.observe (element=$
> > (element)) in IE. Using the new DOM Builder functionality in the trunk
> > branch (http://www.prototypejs.org/2007/5/12/dom-builder) and
> > replacing
>
> >    var el=document.createElement("div");
> >                  el.className = "dot";
>
> > with
>
> >         var el = new Element('div',{className : "dot"});   //Uses the
> > DOM Builder functionality to create the element already extended
>
> > brings the speeds of the browsers much closer together
>
> > Tom


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to