STOP Using JavaScript For These 5 Things!

Поделиться
HTML-код
  • Опубликовано: 2 ноя 2024

Комментарии • 53

  • @b1mind
    @b1mind 10 месяцев назад +30

    Great to see more people sharing how powerful semantic HTML/CSS is these days.

  • @naterpotatoers
    @naterpotatoers 10 месяцев назад +14

    I’ve been using the dialog element a lot lately. It’s super nice. Another thing that I don’t think enough people know about is the HTML Drag and Drop API. Too many people instantly reach for a package to do this when it’s overkill. HTML has that baked in already

  • @CommDao
    @CommDao 10 месяцев назад +1

    Collapsible boxes was something a stumbled on a few years back. Might've overforced it into everything, but I dig it!

  • @Stratelier
    @Stratelier 9 месяцев назад

    I remember (back in the 2000s) coding a nested heirarchial form listbox (basically, accordions inside accordians) via Javascript, because it was much more efficient on network bandwidth for the browser to cache a copy of the list's raw data and dynamically populate the form listbox with it, than to statically include the list with every HTML page request. (This was a huge list with thousands of options nested into hundreds of categories, and highly prone to misclicks were it presented as a single flat list)

  • @nomadshiba
    @nomadshiba 10 месяцев назад +1

    6:20 thats more of a `` expecting an input thats why it uses js.
    there is actually `popover` attribute to create popups that doesnt require js and also closes when you click on the backdrop unlike ``.
    also using all these over a js solution has other advantages as well, such as full accessibility support

  • @CyberTechBits
    @CyberTechBits 10 месяцев назад

    I did know about all of those only because I've had to implement every one in an enterprise PWA. I took the checkbox styling in a different direction that uses the accent-color which provides very nice styling for checked and unchecked states so I don't need nearly as much CSS! Thanks for the video!

  • @TheMeticulousMoo
    @TheMeticulousMoo 10 месяцев назад +1

    Wow, I'm really impressed with the "datalist" element. Thanks for sharing man!

  • @harleyspeedthrust4013
    @harleyspeedthrust4013 10 месяцев назад +1

    I love this kind of stuff. Semantic HTML + CSS is a lot better than a million divs with special class names that you have to remember to use in specific places. I try to avoid writing as much javascript as possible when building pages in plain HTML + CSS. I just wish there was more native styling for the select element, because I find myself using it a lot and being disappointed that CSS just doesn't do much for it. Thankfully our HTML pages are pretty simple (at work) so I can usually get away with the native select and some minimal styling.

  • @doc8527
    @doc8527 10 месяцев назад +2

    Just to add more info for newbies (maybe even mid & senior level dev)? on top of the article, even though some of native components are fully functional nowadays across the browsers. But they are still working in subtle different ways in terms of the stylings and behaviors, which in worst case leads to inconsistent UX, the native components feels like out of touch from your entire application, and the feelings of bug.
    That's why eventually everyone moves to component libraries to ease out all the development hazards.
    As someone who actually implemented all of them in production and faced countless annoying issues from different browsers (mainly Safari, I just hate Safar every single day during that time).
    You definitely want to take the video, the articles with a grain of salt, as well as my opinion. Thing might change in the future. But it's good for you to at least implementing them once before using any component libraries.
    Always remember "it's working across browser" !== "functional with correct stylings and user interaction", people tend to forget the Frontend is not just about coding. You still need to do some manual tests even you have e2e.

  • @borisbojic
    @borisbojic 10 месяцев назад +2

    What’s totally missing in this video is the browser compatibility. Does it work in all major browsers? Chrome only? Firefox?

    • @IainSimmons
      @IainSimmons 10 месяцев назад +1

      They should all work in the 3 main browser engines, with the one exception being styling of the details marker in Safari which still uses a vendor prefixed property (details in the original article).

  • @derickmoncado
    @derickmoncado 10 месяцев назад

    Great tips man! I've only known about the native dropdown/accordion feature in HTML.

  • @dbanswan
    @dbanswan 9 месяцев назад

    Accordian and dialog is neat, did use datalist earlier

  • @ste-fa-no
    @ste-fa-no 10 месяцев назад +1

    There are lots of HTML and CSS functionalities that help make better websites, without nested divs and unnecessary js.
    Remember many people live in places with limited connectivity or don't have the latest smartphone, let aside ads load.

  • @kenscode
    @kenscode 10 месяцев назад

    I had no idea about a few of these, makes me realize I need to pay more attention to what HTML & CSS are up to because it could definitely make my life easier 😎

  • @elephant_888
    @elephant_888 10 месяцев назад +1

    Really good article!! I think these ideas and HTMX will revive simpler frontend coding paradigms for certain.

    • @moopet8036
      @moopet8036 10 месяцев назад

      I don't think so. There have been a lot of cool features in HTML and CSS for a long time, but people don't tend to use them. The popular choice is always to install some JS-heavy alternative, and I don't see that changing. It's like how having a dozen nested DIVs all with utility classes (i.e. Tailwind) is preferred to just having one semantic tag and a couple of lines of CSS. It doesn't matter which is "better", trends gonna trend.

  • @montebont
    @montebont 10 месяцев назад

    Nice one James. Best wishes for 2024 and thanks for sharing. I've used a few of them but the additional details are very helpful. I'll certainly look into Datalist. It might well be an alternative for my custom built "select" elements (200 lines of javascript) I do like our approach to let (latest) html and css do what they can best do.Bookmarked with 5 ******

  • @mattburgess5697
    @mattburgess5697 10 месяцев назад +1

    I built a full component library leaning heavily on the use of HTML dialog for the modal. It has some caveats.
    A lot of things you would expect to work… just don’t. Clicking off the modal is not considered a close action. The back button will continue to navigate even with the modal up. But the hardest to deal with is scrolling. Scrolling will continue to be active in the window behind your modal. I had to implement a JS line that locks body scrolling when the modal opens. It’s not ideal.

    • @kilianvalkhof
      @kilianvalkhof 10 месяцев назад

      Now that :has() has landed you can also use that, no js needed!
      body:has(dialog[open]) { overflow: clip }

  • @Achelon
    @Achelon 10 месяцев назад

    I feel theres some people that skip html/css and are just enforcing js on a lot of stuff. They might still use div's for everything instead of semantic elements as well. Some of them still think Bootstrap is all the rave.

    • @mattburgess5697
      @mattburgess5697 10 месяцев назад +1

      I’ve seen any number of junior devs create something like this because it just hadn’t occurred to them to use a link. Recreating basic HTML form behaviour is also common.

  • @mtwata
    @mtwata 10 месяцев назад

    I'm a pretty crappy frontend dev (not using any JS frameworks), which is probably the reason why I knew about all these features

  • @rrd_webmania
    @rrd_webmania 10 месяцев назад

    I use datalist for 10 years. It is always a good solution. Unfortunately Chrome on Android changed it to display the result list as bubbles at the bottom. Terrible ux imho

  • @T25de
    @T25de 10 месяцев назад

    1:36 daisyUi utilizes the check Box often

  • @SzaboB33
    @SzaboB33 10 месяцев назад

    I would add another important thing that should not be done using JavaScript: Please do not use JavaScript to develop operating systems

  • @Dev-Siri
    @Dev-Siri 10 месяцев назад

    i thought you were gonna talk about not using js for mysql

  • @AlThePal78
    @AlThePal78 9 месяцев назад

    I seen them before but never used them myself :) but not all of them just saw this on another video

  • @moopet8036
    @moopet8036 10 месяцев назад

    JS users: you mean there are elements other than DIV?

  • @mattinykanen4780
    @mattinykanen4780 9 месяцев назад

    Programming is one, but what are the other four?

  • @CristianKirk
    @CristianKirk 10 месяцев назад +1

    Frameworks have generated lazy frameworkers. This is all very basic stuff.

  • @Kats0unam1
    @Kats0unam1 10 месяцев назад

    Amen

  • @SeanGoresht
    @SeanGoresht 10 месяцев назад

    Nope; no surprises here. All things I've been doing without JS for years now...

  • @WebDevXpert
    @WebDevXpert 9 месяцев назад

    How to create button using HTML And CSS || CSS Round Checkbox Button || How to make CSS switch : ruclips.net/video/N0m1guFVs_M/видео.html

  • @omomer3506
    @omomer3506 10 месяцев назад

    One day someone will make it possible to talk to the api from css........

    • @IainSimmons
      @IainSimmons 10 месяцев назад

      You can, if the API is built with only GET requests and image URLs. 😅

  • @ficolas2
    @ficolas2 10 месяцев назад

    Stop using javascript for: anything that doesnt go on your browser frontend.

  • @nomadshiba
    @nomadshiba 10 месяцев назад

    yes i knew

  • @tusharagarwal5306
    @tusharagarwal5306 10 месяцев назад +7

    Stop using JavaScript. Period.

  • @geomorillo
    @geomorillo 10 месяцев назад

    htmx

  • @GeneraluStelaru
    @GeneraluStelaru 10 месяцев назад +4

    I only use div.

    • @montebont
      @montebont 10 месяцев назад

      So did I for a long time. At the end of the day 90% of html is a box. But the roles and behaviour are different

    • @GeneraluStelaru
      @GeneraluStelaru 10 месяцев назад

      @@montebont True. The thig is I don't like having behavior split between HTML and JS, especially if I'm using a framework and the project tends to grow.

  • @sohaibesohaib2914
    @sohaibesohaib2914 10 месяцев назад +1

    why would I not use javascript , internet speed is fast nowdays , phones has a large amount of memory , why even bother my self to hack the browser by using this complexe ::before and ::after

    • @montebont
      @montebont 10 месяцев назад

      It's not about load times :-) Using what's available in html and css might save you a load of design/coding/testing time in JS. That is - IMHO - the point James tries to make...

  • @LE8271
    @LE8271 10 месяцев назад +1

    Or just stop using JS

    • @montebont
      @montebont 10 месяцев назад

      Some of us can't. In my line of work (engineering apps) I must do loads of calculations...

  • @franklemanschik_de
    @franklemanschik_de 10 месяцев назад +5

    Stop using RUclips to spread crappy infos

    • @b1mind
      @b1mind 10 месяцев назад +7

      Stop using YT comments to be a tired troll.

    • @franklemanschik_de
      @franklemanschik_de 10 месяцев назад

      @@b1mind the Titel and you are Trolls Stop using Chrome and Go to wget and curl unqualified......

    • @natescode
      @natescode 10 месяцев назад

      ​@@b1mindSTOP commenting on RUclips comments from tired trolls

    • @montebont
      @montebont 10 месяцев назад +1

      For the life of me I don't understand what's so "crappy" about this? It's not James' opinion. He did put a lot of effort into making a video to share a few good ideas that might save you a lot of time and make you app less complicated by removing "custom code". You may very well disagree but that doesn't make it "crappy".