On Dec 17, 2006, at 2:24 PM, Yehuda Katz wrote:

$('#id').find('.class > .otherClass tr#id td') would be equally optimized as $("#id .class > .otherClass #tr#id td"), so that wasn't the situation I was talking about ;)


Sure, of course. My clarification was not so much directed towards you, but rather towards others who might not understand all of the subtle distinctions yet.

One other thing -- and I'm sorry if I seem nitpicky, but this is again more for the benefit of those who might want to cut and paste or something -- is that your example should have "tr#id" instead of "#tr#id"

Cheers,

--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Dec 17, 2006, at 2:24 PM, Yehuda Katz wrote:



On 12/17/06, Karl Swedberg <[EMAIL PROTECTED]> wrote:
thanks, everyone, for the suggestions and questions.

regarding Yehuda's suggestion:
$(".class > .otherClass tr#id td#id") into $("#id").filter(".class > .otherClass tr#id td")

a small clarification: If #id is an ancestor of .class, we'd probably want to use .find() instead of .filter() . . .

  $('#id').find('.class > .otherClass tr#id td')

$('#id').find('.class > .otherClass tr#id td') would be equally optimized as $("#id .class > .otherClass #tr#id td"), so that wasn't the situation I was talking about ;)

-- Yehuda

Also, a hat tip to Aaron Heimlich, who blogged about this issue, unbeknownst to me at the time, before I did.
http://aheimlich.freepgs.com/javascript/jquery-selector-speed/

--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Dec 17, 2006, at 8:53 AM, Yehuda Katz wrote:

It was a typo. My apologies.

A more robust solution might be to use filter:

$(".class > .otherClass tr#id td#id") into $("#id").filter(".class > .otherClass tr#id td")

On 12/17/06, Klaus Hartl <[EMAIL PROTECTED]> wrote:
Felix Geisendörfer schrieb:
> Quick question:
>> $(".class > .otherClass tr#id td#id") into $("#id").id(".class >
>> .otherClass tr#id td")
> Does this work? Or should the function be 'is' not 'id'?
>
> $(".class > .otherClass tr#id td#id") into $("#id").is(".class >
> .otherClass tr#id td")
>
> I'm just wondering because I thought the 'id' function is used to set
> the 'id' attribute of an element.

I think that's a typo. Still it's not the same, because is() returns a
boolean.


-- Klaus

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/



--
Yehuda Katz
Web Developer | Wycats Designs
(ph)  718.877.1325
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/





--
Yehuda Katz
Web Developer | Wycats Designs
(ph)  718.877.1325
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to