• Potatos_are_not_friends@lemmy.world
    link
    fedilink
    arrow-up
    40
    arrow-down
    1
    ·
    edit-2
    8 months ago

    Half of fine. Half is not. I support their cause because CSS has taken a lot of the complexities of JS with it, and would love to see HTML do more as well.

    But half this stuff is like… Noooooo…

    I’m just waking up so I might be rambly. Sorry. Let’s nail two key issues.

    #1 - The reason why html compiler languages exist is because html is still butt-ugly to write. And without a way to natively include html inside html (or pass data values to a “component”), it’s a LOT of copy/paste.

    Try making a form with 20 labels and include selectors/inputs/text fields. Include errors and help text too. That form element will be at least 400 lines of code, not including wrappers. The quantity isn’t a problem. The problem is it becomes spaghetti. It’s a lot of repeating the same thing over and over again.

    #2 - onclick events

    Edit: Lemmy sync code block markdown is breaking the code. Replaced it with a image.

    The “discouraged” part, I somewhat agree. It’s badly named for one.

    But I don’t agree with the “encourage”. Rarely will adding onclick to turn on a class be the only thing you’re doing. Frequently, you’re swapping classes. Turn one off, turn on another.

    Let’s assume you really are just adding a single event that just adds a class (which in my many years of web dev, is a extremely lucky usecsde)

    You’ve already coupled JS into your html by requiring that event. Why not call it by reference, rather than invoke the command directly? You’ve already added the noise. And a good vanilla JS developer would add all their event listeners into one neat file so you can scan all the events. Versus sprinkling JS actions into the HTML.

    #3 - the build step I kinda agree with, but in the year 2023, we are not ready to remove it. Ignore building for JS frameworks or compiling libraries. The huge bonus for build tools is backwards compatibility. Browsers have gotten extremely better at not requiring browser specific hacks (except Safari. Fuck Safari). But Chrome has been going off the rails lately adding new html/CSS features and forcing everyone to catch up.

    Worse, we cant assume every consumer is updating browsers. Many older tech cannot. Your iPad from 6 years ago no longer gets updated, which means the last browser update it can get is already a few years old. The build system handles that usecase. Again, this requires hardware companies to stop locking their system. But as software people, we can solve that using a build step.