I don't think there are other cases where find works differently than
the traditional selector.

As it stands I don't really see a way to land this change in a way
that won't A) Slow down code and B) Provide weird and inconsistent
results.

Seems like it's probably a no-go. It's funny because I actually
thought about this issue a while back, hoping to try and find a way to
make this simpler, but was unable to think of a good solution. Guess
we're stuck with what we have, for now.

--John



On Tue, Dec 8, 2009 at 11:14 PM, Paul Bakaus <paul.bak...@googlemail.com> wrote:
>
>
> On Wed, Dec 9, 2009 at 4:06 PM, John Resig <jere...@gmail.com> wrote:
>>
>> The problem with this particular proposal is that it kind of throws
>> out the fact that Sizzle works right to left on the selector. We
>> currently evaluate the left-hand-side of the selector first ONLY if
>> there's an #id at the beginning. So we could, theoretically, get your
>> proposal to work but ONLY if the selector began with an ID - and that
>> seems a bit weird.
>>
>> I'd be open to an alternative proposal: Simply removing the need to
>> have to do .contents() before calling .find(), this way you could do:
>>
>> $("iframe").find("body") or $("body", "iframe")
>>
>> Does this work?
>
> I understand the technical implication and problem, but I still think the
> ideal
> solution would be the one proposed.
> Making it only work for id's is pretty weird I agree, but the find()
> proposal is
> only slightly better. I believe that most jQuery users do not see a
> difference
> between
> $('#elem').find('p')
> and
> $('#elem p')
> so again, people would run against a wall when seeing $('#iframe').find('p')
> and then later trying $('#iframe p'). Is there any other case where find
> works
> differently than another selector part?
>
>>
>> --John
>>
>>
>>
>> On Tue, Dec 8, 2009 at 9:24 PM, Paul Bakaus <paul.bak...@googlemail.com>
>> wrote:
>> > Hey guys,
>> > here's a feature request I just added as a ticket
>> > (http://dev.jquery.com/ticket/5617). I was thinking about this for a
>> > long
>> > time
>> > and came to the conclusion that this really fits into Core, not into a
>> > plugin IMHO. Useful and small enough for a broad audience.
>> > Ticket content:
>> >
>> > Currently, the syntax to query iframes looks like this:
>> >
>> > $('#someIframe').contents().find('p').addClass('error')
>> >
>> > which isn't too bad. However, I think another abstraction could really
>> > fit
>> > into our core philosophy, which is transforming the above into this:
>> >
>> > $('#someIframe p').addClass('error');
>> >
>> > I think it wouldn't add much overhead to Sizzle / jQuery, a simple check
>> > if
>> > nodeName equals iframe, and then changing the actual DOM element
>> > representation for further queuries down the selector to the
>> > contentDocument.
>> >
>> > Additionally, make browsing up possible:
>> >
>> > $(document).parent()
>> >
>> > Yay / Nay?
>> > --
>> > Paul Bakaus
>> > UI Architect @ smart.fm
>> > --
>> > http://paulbakaus.com
>> > http://www.linkedin.com/in/paulbakaus
>> >
>> > --
>> >
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "jQuery Development" group.
>> > To post to this group, send email to jquery-...@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > jquery-dev+unsubscr...@googlegroups.com.
>> > For more options, visit this group at
>> > http://groups.google.com/group/jquery-dev?hl=en.
>> >
>>
>> --
>>
>> You received this message because you are subscribed to the Google Groups
>> "jQuery Development" group.
>> To post to this group, send email to jquery-...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> jquery-dev+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/jquery-dev?hl=en.
>>
>>
>
>
>
> --
> Paul Bakaus
> UI Architect @ smart.fm
> --
> http://paulbakaus.com
> http://www.linkedin.com/in/paulbakaus
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "jQuery Development" group.
> To post to this group, send email to jquery-...@googlegroups.com.
> To unsubscribe from this group, send email to
> jquery-dev+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/jquery-dev?hl=en.
>

--

You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-...@googlegroups.com.
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en.


Reply via email to