I do not think so, what about this case:
<script src="prototype.js"></script>
<input type="text" value="ie bug" name="test" />
<input type="text" value="this value should be returned" id="test" />
<script>
alert($("test").value)
</script>
If use your $ in ie and opera it will return null, but it should
return the element which has the id "test" element, so I use $$ and
detect the first matched element. My purpose is let the $ function has
the same result on all the browsers. No matter ie opera or firefox or
safari
On Jun 17, 8:00 pm, DK <[EMAIL PROTECTED]> wrote:
> I agree with jdalton - performance hit.
> I agree also that you shouldn't use the same values for name's and
> id's.
>
> $() is made for one purpose - to find elements with given id. It
> should be VERY fast in every case as it's a base function of
> Prototype.
>
> IMO, if found' element's id isn't the same as given, maybe function
> should even return null:
> [...]
>     if (typeof element == 'string')
>     {
>         var id=element;
>         element = document.getElementById(element);
>         // not found
>         if (element === null || !element.id || element.id!=id) {
>             return null;
>         }
>     }
>   return Element.extend(element);
> [...]
>
> On Jun 17, 11:36 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>
>
>
> > Wait for your solution, however this performance hit only occur in the
> > ie and opera and you select the input without an id attribute, maybe
> > 1%'s probability. Will $$("*").detect take a very long time? long than
> > 2 seconds? Is that posibble? Thanks- 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 [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
-~----------~----~----~----~------~----~------~--~---

Reply via email to