News for hackers. Stuff that matters.
Re:Gov.uk drops jQuery from their front end by yyyk on Thursday May 19, 2022 @12:11PM (#31436529)
>That has the same ergonomics as the jQuery selector

Nitpick: This crashes if #element doesn't exist, while the jQuery one does not. Also, the jQuery selector is a tiny bit more powerful (:even, :odd).

IMHO, jQuery is good for what it's built for - a nicer interface than vanilla - but the main use case is much less needed now that frameworks exist.

Re:Gov.uk drops jQuery from their front end by jacobsenscott on Thursday May 19, 2022 @12:53PM (#31437063)
A but fugly, ?. helps - document.querySelector('#element')?.style?.SetPropery('display', 'none')
Re:Gov.uk drops jQuery from their front end by MrJohz on Friday May 20, 2022 @12:24AM (#31443341)
I don't know if that's such a good nitpick in practice. I want my code to crash if my assumptions aren't true - especially if I'm in the process of developing the code, I want to see big red errors and stack traces that point directly to the line that failed.

If it's meant to be the case that the element may or may not be present, then I'd much rather see an explicit check for that, than assume one thing and find out another later.

Re:Gov.uk drops jQuery from their front end by zamadatix on Thursday May 19, 2022 @12:32PM (#31436804)
The same power exists, again a bit longer, :nth-of-type(odd).