Created — forked from cowboy/jquery.ba-nodetype.js

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist
View jquery.ba-nodetype.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
/*!
* jQuery nodetype filter - v0.1pre - 11/18/2010
* http://benalman.com/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*
* Variation by Anton M.
*/
 
(function($){
var types = {
element: 1,
text: 3,
comment: 8
};
$.fn.nodetype = function( type ) {
var type = typeof type === "string" ? types[ type.toLowerCase() ] : type;
return jQuery( jQuery.grep( this, function( ele, i ) {
return ele.nodeType === type;
}));
};
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.