Sourcehut has No JavaScript as one of it’s selling points, so i was wondering why it would be better that way?

  • Aarkon@feddit.de
    link
    fedilink
    arrow-up
    3
    ·
    2 years ago

    I’d argue that it’s not a question of yes or no, but of how much. Personally, I prefer pages that work as expected without enabling them in NoScript too, but that doesn’t extend to phones too well imho.

    That’s because you’ll at least have a pretty hard time getting mobile navigation right without JavaScript, at least if you don’t want to fall back to odd tree shaped navigation menus which are always visible or something like that. There are CSS hacks for that, but those violate the distinction between content and representation.

    • rysiek
      link
      fedilink
      arrow-up
      3
      ·
      2 years ago

      Violating the distinction between content and representation in the form of a few hidden radioboxes or checkboxes to be able to make a JS-less menu strikes me as a reasonable trade-off in a lot of cases.

      Pretty advanced UIs things can be done using just CSS. For example, this little tidbit of mine. It’s not mobile-optimized, but that’s beside the point — the point is a complex interface done without a line of JS. Making it mobile-optimized is possible too, of course.

      • Aarkon@feddit.de
        link
        fedilink
        arrow-up
        3
        ·
        edit-2
        2 years ago

        I see your point. On the page that I’m building, the mobile navigation menu is the only usage of Javascript and I think that’s reasonable (desktop users are way more likely to disable JS than mobile users, for whom you should optimize anyway in most cases). Of course, there are other use cases where content is really dynamic (e.g. Etherpad), which you just can’t tackle with only HTML & CSS.

        In my opinion, it’s those little things that JS is good at and CSS is (currently) not. JS is a tool, neither more nor less, and like with all tools, it’s more important what you do with them than what tool you use.

        That’s not to say that I’m not in line with you that 95-99% of all JS code in modern web pages is bloat in the best case and acting against the users interest (like by spying on them) in most others, and I’m in no way an apologist for it. Condemning its usage altogether throws the baby out with the bathwater though imho.

        Oh, and on performance: JS is pretty optimized today as well. A lot of waiting for modern web pages is due to loading of external resources, which would hardly be any faster if done in C*. In conclusion, we’re blaming the language for what people do with it. 😉

        * I’m not saying that 3rd party assets are necessary or good, it’s just an observation

        • rysiek
          link
          fedilink
          arrow-up
          3
          ·
          2 years ago

          Sure, I think we basically agree.

          There are things that are impossible without JS, and there are things that are possible without it but JS is still the better choice for implementing them — as long as it’s not the bloated mess, pulling random libraries from a dozen third party services, that we know and “love” from a lot of websites. And as long as there is graceful degradation built-in.