Diogo -
I would rather shoot for something that's a little more idiomatic to
jQuery. For example jQuery already has a way to figure out if an
element contains a selector: "div:has(a)".
Thus, I think a better result would be:
$("div").has("a") // true
$(document).has("div") // true
$(document).has(document.getElementsByTagName("div")[0]); // true
--John
On Tue, Dec 16, 2008 at 4:37 PM, Diogo Baeder <[email protected]> wrote:
>
> Great ones, John!
>
> What about "isOrphan()" or "inDOM()" methods, to prevent uneeded JS
> processing for non-existant elements, as discussed before?:
> http://groups.google.com/group/jquery-dev/browse_thread/thread/ac5ca8eaa64fe9f1/af83ebdd79de479a?q=indom&lnk=ol&
>
> Maybe a long discussion, but everybody contributed for the community to
> have a nice implementation, right?!
>
> Congratulations for the great work!
>
> Diogo
>
>
>
> John Resig escreveu:
>> Hi Everyone -
>>
>> I have the first round of jQuery 1.3 patches ready:
>> http://dev.jquery.com/~john/jquery1.3/
>>
>> This is in addition to the Sizzle selector engine patch which I posted
>> a little bit ago (and which I'll be making an updated version of very
>> soon).
>>
>> The patches are as follows:
>>
>> append.patch: Use DocumentFragment in .domManip. This is a large
>> overhaul of .domManip (and moves some of the logic into jQuery.clean).
>> The result is that manipulation code (append/prepend/etc.) is about
>> 15x faster. During this overhaul I made a change to how scripts are
>> executed. Roughly it means that scripts that are brought in as a
>> string and inserted are executed - but scripts that exist as DOM nodes
>> are not. This will solve the common problem wherein a script that
>> already exists in the page will be dual-executed. Let me know if this
>> affects your code - I suspect we'll learn more during the beta, as
>> well.
>>
>> append-2.patch: Just in case, this is the same patch as above, but
>> with the old-style of functionality intact.
>>
>> closest.patch: This adds a new method: .closest(selector). You can
>> think of it as .firstSelfOrAncestor. This has been a commonly
>> requested function and it will make implementing delegation code
>> trivial.
>>
>> domready.patch: An overhaul of the ready code, removing the the "wait
>> for stylesheets to load" logic. I did a bunch of testing on this and
>> it really appears as if it's impossible to get proper stylesheet
>> loading detection implemented (I wanted to have a "cssready" event for
>> 1.3, but it's not looking likely). Instead we need to back off and
>> simply provide normal DOM ready functionality in .ready(). This means
>> that we need to educate users to include their stylesheets before
>> their scripts in order for them to be accessible in time for DOM
>> ready.
>>
>> multi-namespace.patch: This adds multiple-namespace support to events.
>> Previously you could only do it with one namespace e.g.
>> .bind("click.foo") or .trigger("click.foo"). The patch allows you to
>> use any number of namespaces e.g.
>> .bind("click.foo.bar").trigger("click.bar").unbind(".bar.foo").
>>
>> selector.patch: Adds a new internal property that keeps track of the
>> selector chain.
>> $("div").find("span").filter(":hidden").parent().selector == "div
>> span.filter(:hidden).parent()". This is meant to be used by plugins
>> (like liveQuery), primarily. The implementation of selectors like
>> .parent() will be coming in a follow-up patch along with Sizzle.
>>
>> strict.patch: Makes it so that we pass strict mode in Firefox 3. Only
>> a few minor tweaks necessary.
>>
>> I have the following patches coming:
>> - Landing Sizzle
>> - Landing .parent()/.filter()/etc. selector implementation.
>> - Native event delegation
>> - Removing the remaining uses of jQuery.browser
>>
>> --John
>>
>> >
>>
>>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery Development" 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/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---