201
you are viewing a single comment's thread
view the rest of the comments
[-] elxeno@lemm.ee 15 points 6 months ago* (last edited 6 months ago)

The script attempted to modify a div's background color using document.body.removeChild, but as the script was loaded in the HTML head, the DOM had not loaded

Isn't that how it works/always worked? When i was learning html/js ages ago i had to use some event listener (DOMContentLoaded i think) or put the script just before </body> (for any code that should run on load and interacts with the DOM).

And how do you change the background by removing a child?

[-] ReversalHatchery@beehaw.org 3 points 6 months ago

And how do you change the background by removing a child?

The removed child could also have a background color, and it could span the entire area of the parent element.
But it's weird because the quote says "modify a div's background color", and this way you don't actually modify that, but only it's appearance.

Or maybe it's done with some CSS trickery, looking for a specific child in it's selector?

[-] sugar_in_your_tea@sh.itjust.works 3 points 6 months ago

Yeah, they should be listening for an event, not just YOLOing it in the head, that's just racey...

this post was submitted on 04 May 2024
201 points (99.5% liked)

Firefox

17303 readers
98 users here now

A place to discuss the news and latest developments on the open-source browser Firefox

founded 4 years ago
MODERATORS