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)?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype: Core" 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/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---