Skip to content

Instantly share code, notes, and snippets.

@jakearchibald
Created December 18, 2009 17:20
Show Gist options
  • Save jakearchibald/259626 to your computer and use it in GitHub Desktop.
Save jakearchibald/259626 to your computer and use it in GitHub Desktop.
/**
@name glow.NodeList#filter
@function
@description Filter the NodeList
@param {Function|string} test Filter test
If a string is provided, it is used in a call to {@link glow.NodeList#is NodeList#is}.
If a function is provided it will be passed a single argument
representing the index of the current item in the NodeList.
Inside the function 'this' refers to the Node.
Return true in the callback include the node in the new NodeList.
@returns {glow.NodeList} A new NodeList containing the filtered nodes
@example
// return images with a width greater than 320
glow('img').filter(function(i, nodeList) {
return glow(this).width() > 320;
});
@example
// Get items that don't have an alt attribute
myNodeList.filter(':not([alt])');
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment