I rewrite it like this, I know this is very ugly someone can improve
it?
        if(!element.id || element.id!=id)
        {
                var tmp=[];var y=100;
                var t=document.getElementById(id);
                while(t!=null && t.id!=id)
                {
                        var e=t.outerHTML;
                        y++;
                        t.outerHTML="<hr id='"+y+"'>";
                        tmp.push([document.getElementById(y),e]);
                        t=document.getElementById(id);
                }
                element=t;
                tmp.each(function(node){
                node[0].outerHTML=node[1];
                });
        }
However, it works, with the good performance which I believe. Thanks
for reply

On Jun 17, 11:11 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> What about this code:
>         if(!element.id || element.id!=id)
>         {
>                 var tmp=[];
>                 var t=document.getElementById(id);
>                 while(t!=null && t.id!=id)
>                 {
>                         tmp.push([t,t.name]);
>                         t.name+="_tmp_";
>                         t=document.getElementById(id);
>                 }
>                 element=t;
>                 tmp.each(function(node){
>                 node[0].name=node[1];
>                 });
>         }
> However the ie protect its input element and do not let setAttribute
> change its name attribute, only way to change it is to change
> outerHTML which is very ugly, so I believe $$("*").detect is the best
> way.
>
> On Jun 17, 9:34 pm, "Mislav Marohnić" <[EMAIL PROTECTED]>
> wrote:
>
>
>
> > On 6/17/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> > > is there some performance difference between these two code? Thanks
>
> > Using the CSS selector instead of Enumerable enables the use of XPath. But
> > since IE doesn't support XPath and the hack above is for IE and Opera, I'd
> > dare to say that there is no much difference in execution time. One more
> > thing:
>
> >   $$('*[id=' + id + ']')
>
> > Am I right when saying that this will fail if the ID was dynamically set (in
> > other words, it was not an attribute in HTML source)?- Hide quoted text -
>
> - Show quoted text -

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to