>Which of these would be faster?
>
>$("#myForm").each(function(frmI,frm){
> $("input.classA",frm)...
> $("input.classB",frm)...
> $("#inputC",frm)...
>});
>
>or
>
>$("#myForm input.classA")...
>$("#myForm input.classB")...
>$("#inputC")...
The 2nd set definitely does a lot less
Which of these would be faster?
$("#myForm").each(function(frmI,frm){
$("input.classA",frm)...
$("input.classB",frm)...
$("#inputC",frm)...
});
or
$("#myForm input.classA")...
$("#myForm input.classB")...
$("#inputC")...
On Jun 27, 2:03 pm, "John Resig" <[EMAIL PROTECTE
I thought it would. How could I think otherwise.
Sorry John ;-)
On Jun 27, 7:03 pm, "John Resig" <[EMAIL PROTECTED]> wrote:
> They're both just as fast as each other - jQuery has an optimization
> in place to account for that.
>
> Terry: I assume that you mean "div#TimelineContainer" in your firs
Hey, no worries. I understand the motivation was good. :)
--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com
On Jun 27, 2007, at 4:48 PM, Terry B wrote:
sry man, i wasnt meaning to get on ya... i wanted to just to point it
out cause some ppl really dont kno
sry man, i wasnt meaning to get on ya... i wanted to just to point it
out cause some ppl really dont know and i would luv to see the
developers actually enforce it and not make it easy to be lazy :D
so, again sorry...
On Jun 27, 4:12 pm, Karl Swedberg <[EMAIL PROTECTED]> wrote:
> Yes, of cour
Yes, of course, Terry. I didn't mean to suggest that having multiple
IDs is a good idea.
I was just noting that the ID selector $('#TimelineContainer') will
not select "any" element with that ID.
It will only find one -- even if someone wrongly has more than one
element with the same ID.
The whole point of having an ID is to have a unique id. You should
not be assigning the same ID name to multiple objects. Use classes if
you want to handle multiple objects.
http://www.w3.org/TR/1999/REC-html401-19991224/struct/global.html#adef-id
id = name [CS]
This attribute assigns a name t
On Jun 27, 2007, at 2:02 PM, Ganeshji Marwaha wrote:
the second one [ $t("#TimelineContainer") ] will select any element
with an id of "TimelineContainer"
Quick clarification. This will only select the first one it finds in
the DOM. To find any element with an id of "TimelineContainer," we'
yea already been testing the methods and going from div.[name] to
#[name] took my script from 70s to 16s. i also tested using the
document.getElementById('[name]') and there was no difference between
that and using #.
no more div.[name] for me
On Jun 27, 1:57 pm, "Diego A." <[EMAIL PROTECT
They're both just as fast as each other - jQuery has an optimization
in place to account for that.
Terry: I assume that you mean "div#TimelineContainer" in your first example.
--John
On 6/27/07, Diego A. <[EMAIL PROTECTED]> wrote:
I'm not sure, but I'm guessing there will be some sort of per
the first one will find all the "div" elements with a class name of
"TimelineContainer".
the second one will any element with an id of "TimelineContainer"
-GTG
On 6/27/07, Diego A. <[EMAIL PROTECTED]> wrote:
I'm not sure, but I'm guessing there will be some sort of performance
difference. I'
I'm not sure, but I'm guessing there will be some sort of performance
difference. I'm guessing '#id' is faster than 'div#id' if '#id' just
uses getElementById, whereas 'div#id' might finds all divs then filter
by id.
On Jun 27, 5:46 pm, Terry B <[EMAIL PROTECTED]> wrote:
> what is the difference
12 matches
Mail list logo