jQuery made the decision to do this, not JavaScript.
That was, and still is, rare! And in a time without type checking and bundling, it was vital. Match your parentheses and quotes, and your jquery code might not find what you want, but it would (likely) not throw exceptions.
For those unfamiliar, I recommend looking at https://github.com/DefinitelyTyped/DefinitelyTyped/blob/mast... and searching for the 201 instances of
: this
in that file. A remarkably fluent API. We could all be so elegant.A TC39 Stage 2 proposal adds this into the language itself with the pipeline `|>` operator. [2]
Maybe not precisely the same from a technical point of view but is it just pendantry to argue against someone referring to it as a fluent interface? Happy to learn and to be corrected if required.
To suggest the pipeline proposal must not be referred to as a "fluent interface" would seem to me to be arguing semantics, ignoring the point behind the words, or the facts that they can have implied meanings or subtle changes over time.
|> docker.listContainers() filter(x => x.name == “something”) first getNetwork getIpAddress toString ping
(ignore that some of these should be chained and some should be arguments, I haven’t read the proposal fully)
They’re doubly nice in Clojure because of the lazy evaluation. You can map a pipeline over a list and it will evaluate one at a time rather than pre-evaluating and allocating memory for the whole thing.
Which true is not per se fluent interfaces, but it reads similarly. And "fluent" as the name suggests, has a lot to do with how it reads.
I hope https://github.com/tc39/proposal-pipeline-operator and perhaps also https://github.com/tc39/proposal-do-expressions will put it to rest.
Jquery is only not relevant if you're living in a tech bubble that demands that "new, shiny" is the only thing that could possibly be relevant.
But still everywhere!
They have the small surface area of jQuery, but still aim for component-based reactivity and SSR-when-possible which just aligns more with the mental model and development preferences that have developed from the whole world of React/Next and similar.
I'd still recommend keeping it at a minimum though. Rather rely on tools like htmx.
I had to use it on a legacy site recently and forgot how nice it was and it all just came back to me too. Didn’t need docs either. That’s a sign of a very well designed lib