public
Last active — forked from cowboy/jquery.ba-nodetype.js

  • Download Gist
jquery.ba-nodetype.js
JavaScript
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);

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.