Hello, On Tue, Dec 08, 2009 at 11:06:31PM -0800, John Resig 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:
I really like this idea. As a new jQuery user doing $("#iframe").find() was the first thing I tried when I needed this. I quickly found .contents() in the documentation after that, but being able to use .find() directly would be much better. > On Tue, Dec 8, 2009 at 9:24 PM, Paul Bakaus <paul.bak...@googlemail.com> > wrote: > > 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. If $('#someIframe p') selects all paragraphs in the iframe, I would also expect just $('p') to include all paragraphs of child documents in addition to the paragraphs in the current document -- that doesn't seem like a useful thing to do. -- kuno. -- 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.