4 ms·
When you say 'rely on jQuery', I think it would be more precise to say that it relies on CSS selectors. Most libraries will actually provide you a way to access
by rb2k_ 14y ago
When you say 'rely on jQuery', I think it would be more precise to say that it relies on CSS selectors. Most libraries will actually provide you a way to access an HTML parse tree in that way.
I guess phantomjs is a good a tool as any, but there is really no need to evaluate Javascript for a bit of plain HTTP+HTML parsing.
- mistercow 14y agoIt looks to me like it's using jQuery specific functions. It could be done with a simpler selector engine, but in this case, it looks pretty clear that it's either jQuery or a compatible library like Zepto.
- rb2k_ 14y agoAs far as I see the only line with selectors is: > return [ $($('h2 a')[0]).attr('title'), $($('h2 a')[1]).attr('title') ]; which are 2 css selectors and picking an element. That is pretty much covered by all of the available http parser libraries
- mistercow 14y agoIt's CSS selectors and then wrapping the DOM element again in a function to give it an `attr` method, which is jQuery style. Other libraries may use that syntax too, but I'm pretty sure it started with jQuery (and if not, was certainly popularized by it).