News for hackers. Stuff that matters.
Re:GetElementById vs. QuerySelector by mysecretaccount on Thursday November 25, 2021 @11:09PM (#29347412)
> querySelector return a static node while getElementById returns a live node. If the element returned by getElementById is deleted in the DOM, the variable becomes unavailable while for querySelector you get a snapshot of the node that lives on.

I'm mostly sure that this is not true: https://imgur.com/a/XaS3b0W

Re:GetElementById vs. QuerySelector by throwanem on Thursday November 25, 2021 @11:15PM (#29347443)
It makes sense that that would be the case. You still have a reference in scope to the element, so the GC leaves it alone. I could see the described behavior as a bug in maybe an older engine, but so far as I can recall I've never run into it in practice.