Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Convenience methods to determine whether or not an element is attached or detached from the DOM
(function( jQuery ) {
jQuery.extend({
attached: function( elem ) {
if ( elem instanceof jQuery ) {
elem = elem[ 0 ];
}
return jQuery.contains( elem.ownerDocument.documentElement, elem );
},
detached: function( elem ) {
return !jQuery.attached( elem );
}
});
})( jQuery );
@kflorence

This comment has been minimized.

Copy link
Owner Author

@kflorence kflorence commented Apr 28, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment