I think there are some places in jQuery core where we might be able to
use a method like this (not yet - but we will eventually). Like when
determining if a script should be executed.
--John
On Wed, Nov 26, 2008 at 9:52 PM, diogobaeder <[EMAIL PROTECTED]> wrote:
>
> Hi there,
>
> I'm new here (and in jQuery), but even though I'd like to propose some
> simple but usefull method to the jQuery object (at core.js) to tell
> the API user if an element exists in the document. I've tried to build
> one as follows:
>
>
>
> [CODE]
> (function($) {
>
> $.fn.inDOM = function() {
> return !!this.parents('body').length;
> };
>
> })(jQuery);
>
> jQuery(document).ready(function(){
> var jEl = $('.someExistingClass');
>
> // Should be in DOM
> console.debug(jEl.inDOM());
>
> // Removing the element
> jEl.remove();
>
> // Should NOT be in DOM
> console.debug(jEl.inDOM());
> });
> [/CODE]
>
>
>
> So, if the client sets a variable as a jQuery object, and at some
> point of the code the DOM element within it can be removed, he/she can
> test if it really was. OK, I know it sounds unsignificant, but I think
> it would still be usefull.
>
> Thanks!
>
> Diogo Baeder
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---