by Gualdrapo · 2w ago · 0 comments
$('.mispell').hide()
No error. Just silent. This is why jQuery is not a good library other than for 2010 cross-browser development.
Wouldn't you notice with your eyes the thing didn't hide as expected?
Silent errors are by design I recall. Confirming with nearest AI... yep and a good explanation, please excuse the AI paste:
A selector is treated like a query that returns a collection (which can legitimately be empty). Applying an action to zero items isn’t an error it’s just a no-op. This is similar to how CSS works (no harm if no .foo) or how many collection methods work in other languages.I do frequently, partially because I tend to branch new projects from old ones, and the old ones often used jQuery. Updating everything to vanilla would be a lot of effort for little gain.
I wonder how it feels for the original jQuery developers. They solved some big problems, then their ideas were just copied into Javascript itself, and their pioneering library became decried as old and irrelevant--even though it works just fine, and still solves some niche problems.
I'm a jquery fanboy, and enjoyed seeing native JS copy good patterns, it only confirms jquery were onto something.
All good, native JS is now better because it copied. Although $('.foo').hide() wasn't copied but should have been. Hiding stuff is an archetypal biological need!
Nothing stopping Jquery 5 and beyond doing something different like, I dunno, "game enginey" helper things, IOT tricks, it can do whatever it wants now.
W3Counter shows Around 0.07% of market share.
I wonder why IE11 is still being used or even a requirement? Especially in today's world where security could be a very serious issue.
Only on Windows 10 and 11. It still runs as it always did on previous Windowses.
That being said it's no longer that useful for dealing with browser incompatibilities or for remote calls. I end up using a stripped version or something like https://github.com/fabiospampinato/cash
What vanilla is obviously unbeatable for is, you're writing a snippet of JS that you can hand anyone[1] to run with no dependency requirements. Some codebases may be explicitly incompatible with JQ, so knowing how to do all the JQ basics "vanilla" is an important skill so you don't have to bring in a "big" (relatively, I mean) library to support a 7-line function.
[1] for example, an embed code, an analytics tag, or a script to customize the markup on a page.