Skip to content

Instantly share code, notes, and snippets.

@chicagoworks
Created January 3, 2011 20:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chicagoworks/763875 to your computer and use it in GitHub Desktop.
Save chicagoworks/763875 to your computer and use it in GitHub Desktop.
jquery.offspring.js: perform the same duty as children but includes free floating 'text' nodes
//perform the same duty as children but includes free floating 'text' nodes
jQuery.fn.extend({
offspring: function() {
return jQuery(
jQuery.map( this, function(n){
return jQuery.grep(n.childNodes, function(n) {
return n.nodeType == 1 || n.nodeType == 3;
});
})
);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment