Since I used d3.js for one project a few years ago, I have not touched jQuery ever since. d3 offers key jQuery features, but goes much more beyond that.
You can check the documentations here:
https://github.com/d3/d3/wiki/Requests
Those methods are quite powerful.
And it's the default choice for any complex web data visualization project.
In D3 you can do selection.classed('active', false). This is equivalent to toggleClass().
According to jQuery's API, show() "... is roughly equivalent to calling .css( "display", "block"), except that the display property is restored to whatever it was initially." Instead of show, you can just do selection.transition().duration(300).style(display, 'block').
The length method? You can just use JavaScript's native .length.