363

Original post: fedi.aria.dog (~~fat Yoshi~~ Akkoma?)

you are viewing a single comment's thread
view the rest of the comments
[-] DarkenLM@kbin.earth 20 points 2 years ago

Shadow DOM trees are very real, and I feel like a Wizard trying to decrypt ancient runes every time I have to deal with them, so you're not far off.

[-] boonhet@lemm.ee 5 points 2 years ago
[-] Ephera@lemmy.ml 12 points 2 years ago

The browser has an internal model for representing the HTML document, called the Document Object Model (DOM). This DOM happens to be tree-shaped, because HTML is tree-shaped. And certain logic in a browser gets applied to subtrees, like e.g. most CSS rules.

Sometimes, however, you want a subtree to not get affected by what's going on in the main tree, for example when including an SVG into that tree, or if you're offering JavaScript library with a pre-built component.
And yeah, that is what the Shadow DOM does. It also shields the rest of the DOM from what you're doing inside the Shadow DOM. And there's certain mechanisms to selectively allow interaction across the shadow boundary, e.g. when providing a pre-built component, you might still want the user to be able to style parts of it.

[-] ayyy@sh.itjust.works 1 points 2 years ago

If you’ve ever built a backend MVC style (Model, View, Controller) it’s very similar but for web documents instead of remote procedure calls.

[-] virku@lemmy.world 1 points 2 years ago* (last edited 2 years ago)

I think the other comment was an excellent explanation of what the DOM is for somebody with a little bit of computer science experience at least.

But front end vs back end development explained like youre five:

  • a front end developer makes what you can see when you use some software (the term is mostly used when talking about web development, but almost all business software is websites today). So they know how to place buttons in the right place, how to make it look good or move around or what ever you want your website to do. I.E display a form to fill out when you want to check out your shopping basket in a web shop.

  • a back end developer makes the logic that happens behind the scenes and makes it available for the front end. I.E. Pass on the data from the form the user just entered to the orders database.

  • a full stack developer knows how to do both.

Edit: just realised I misunderstood your question. Keeping the comment though since somebody Else might not know the difference between backend and frontend

[-] boonhet@lemm.ee 2 points 2 years ago

Ah yeah, I'm a backend developer already, I was wondering what the heck a Shadow DOM is (as opposed to a regular DOM which I do understand). Luckily some of the other comments put together give me a decent summary.

this post was submitted on 22 Jan 2025
363 points (97.9% liked)

Microblog Memes

12596 readers
3480 users here now

A place to share screenshots of Microblog posts, whether from Mastodon, tumblr, ~~Twitter~~ X, KBin, Threads or elsewhere.

Created as an evolution of White People Twitter and other tweet-capture subreddits.

RULES:

  1. Your post must be a screen capture of a microblog-type post that includes the UI of the site it came from, preferably also including the avatar and username of the original poster. Including relevant comments made to the original post is encouraged.
  2. Your post, included comments, or your title/comment should include some kind of commentary or remark on the subject of the screen capture. Your title must include at least one word relevant to your post.
  3. You are encouraged to provide a link back to the source of your screen capture in the body of your post.
  4. Current politics and news are allowed, but discouraged. There MUST be some kind of human commentary/reaction included (either by the original poster or you). Just news articles or headlines will be deleted.
  5. Doctored posts/images and AI are allowed, but discouraged. You MUST indicate this in your post (even if you didn't originally know). If an image is found to be fabricated or edited in any way and it is not properly labeled, it will be deleted.
  6. Absolutely no NSFL content.
  7. Be nice. Don't take anything personally. Take political debates to the appropriate communities. Take personal disagreements & arguments to private messages.
  8. No advertising, brand promotion, or guerrilla marketing.

RELATED COMMUNITIES:

founded 3 years ago
MODERATORS