CSS JavaScript
Switch branches/tags
Clone or download
szarouski Merge pull request #1 from gitter-badger/gitter-badge
Add a Gitter chat badge to README.md
Latest commit 4d63b20 Jan 27, 2015

README.md

lodash.dom-traverse

Gitter

tiny (1.28kb min, gzip) lodash extension for dom traversing (for those cases where native dom is not so easy to use):

_.$(selector, context); //get element(s)
_.$(selector, context).find(selector); //traverses down
_.$(selector, context).filter(selector); //filter by selector
_.$(selector, context).filter(function () {}); //filter with function
_.$(selector, context).siblings(); //get siblings
_.$(selector, context).next();  //get next
_.$(selector, context).prev();  //get previous
_.$(selector, context).nextAll();  //get all next
_.$(selector, context).prevAll();  //get all previous
_.$(selector, context).text(); //get text for element(s)
_.$(selector, context).text(string); //set text
_.$(selector, context).is(selector); //check if matches selector
_.$(selector, context).closest(selector); //traverses up
_.$(selector, context).css({}); //sets styles
_.$(selector, context).css(string); //returns style

easy to chain

_.$('table td').filter(_.$.simpleOdd).css({'background-color': 'rgb(0, 0, 0)'}).text()

==============

Browser support

  • IE8+
  • Modern browsers