Hacker News new | past | comments | ask | show | jobs | submit login

Absolutely yes.

jQuery selector engine was developed before the official Selector API, which ended up being almost exactly the same. Except for a few exceptions which John wasn't too sure about when they asked for feedback:

https://johnresig.com/blog/thoughts-on-queryselectorall/




I don't know what you think that link shows (I don't know what John thought it showed, either—it's a classic "talking to one's own head, instead of who you're trying to communicate with" situation, and David Baron's confusion on the mailing list at the time is understandable).

To reiterate:

> The argument for querySelector / querySelectorAll calls is literally mimicked from John Resig's grounbreaking API design

No, it wasn't. "The argument for querySelector / querySelectorAll calls" is literally ... CSS's selector language, which predates jQuery by about a decade. And the idea to make a library function to match against selectors was conceived of and implemented by Simon Willison years before jQuery was released, spawning lots of copycats. jQuery was literally named jQuery because writing a library to do this was the hotness at the time and one such library Resig had used was called cssQuery.

(jQuery does do a lot more than just match CSS selectors, but what that involves is not something jQuery has in common with querySelector—it's nowhere near "almost exactly the same". The result of a jQuery call has a weird, jQuery-specific shape. (It's not an element node). If Simon's getElementsBySelector did what jQuery did, Resig wouldn't have written jQuery.)

This is a matter of public record, and to state or suggest otherwise is worse than just being wrong. It misleads and confuses people.

<https://twitter.com/simonw/status/1536129600232665088>

<https://www.slideshare.net/jeresig/history-of-jquery>


Using CSS to select elements within the browser arguably only became popular because of jQuery, (and Prototype, Mojo, etc.). The browser inbuilt suggestion at the time was to programmatically navigate the DOM, or maybe use XPath. Proposing CSS selectors as a browser API before it became dominant in the wild via alternatives would have got a "why do we need another option?" response.


So you couldn't get away with lazy and ignorant two word answer and it forced you to write quality one :)

One would argue whether we'd have querySelector if jQuery wasn't as popular. We may have an inspiration chain here... but thanks for pointing out to prior art.


Please don't cross into personal attack, regardless of how wrong someone is or you feel they are. It's not what this site is for, and destroys what it is for.

https://news.ycombinator.com/newsguidelines.html


You're mixed up in your understanding of how burden of proof works and who has it here. Spoiler alert: it's the burden of the person making the claim—not the one dismissing it.

> lazy and ignorant

Go fuck yourself.


Please don't cross into personal attack, regardless of how provocative someone is being or you feel they are. It's not what this site is for, and destroys what it is for.

https://news.ycombinator.com/newsguidelines.html




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: