this post was submitted on 21 Jan 2026
375 points (99.2% liked)

Programmer Humor

28720 readers
2685 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] dan@upvote.au 38 points 3 days ago* (last edited 3 days ago) (2 children)

If your element has an id, you can just reference it from the window scope

This is brittle, as defining a global variable with the same name (or the browser adding a API with the same name) will override it. This functionality was only kept for backwards compatibility with sites designed for Internet Explorer. The spec says to use getElementById instead.

[–] bleistift2@sopuli.xyz 15 points 3 days ago

Aww man. I only found out about this recently :(

[–] bestelbus22@lemmy.world 7 points 3 days ago

I knew about this feature yeah but it seemed too janky to me (which says something, you should see the rest of my project :P)