What would it take to make writing vanilla JavaScript more pleasant? After reviewing the code for my blogging engine Lamb I concluded:

Most of the code adding interactivity to personal websites comes down to running code after the page has loaded; niceties to query the DOM and hook into events. There's probably more but this is a start. The result is shorthand.js. Hint: it's not dissimilar to jQuery, but you can fully learn it in 5 minutes.

Which simplifies code to:

onLoaded(() => {
    const forms = $$('form.form-delete')
    forms?.forEach($form => $form.on('submit', ev => {
        cancel(ev)
        let confirmed = confirm(`Really delete status ${ev.target.dataset.id}?`)
        if (!confirmed) return
        ev.target.submit()
    }))
})

This is just a prototype and will evolve.

#technology #products #lamb

January 3 at 2:07 pm

Related posts

  • February 21 at 11:07 am Navigate Xbox Series console using LG remo…
  • February 12 at 10:38 am Looking at my browser tabs, I can't believ…
  • January 31 at 2:30 pm Content vs crap. #technology…
  • January 31 at 11:57 am Use an expression to select an array value…
  • January 23 at 11:21 am Why do web-browsers not have a dedicated &…
  • January 16 at 4:33 pm Finally updated my #WordPress Blocks In Pl…
  • January 3 at 2:07 pm What would it take to make writing vanilla…
  • January 2 at 4:37 pm If you're using the Anytype (current versi…
  • December 11 at 8:51 am I experimented with _hyperscript to replac…
  • November 14 at 10:08 am Ashley Belanger writes for Ars Technica Ap…
  • September 22 at 9:12 am On personal goals…
  • September 9 at 12:56 pm If you want an example of why we need a vi…
  • August 3 at 9:03 am Anchor bugs in Blink engine browsers…
  • April 10, 2023 at 10:41 am The AI evolution seems scary until you rea…
  • April 6, 2023 at 10:43 am Ubuntu's minimal installation appears to b…
  • March 24, 2023 at 7:24 am Anyone, regardless of coding experience ca…
  • December 6 at 2:28 pm Lamb image test…
  • July 28 at 11:43 am Lamb 0.3.0…
  • March 24, 2023 at 9:46 am Lamb 0.2…
  • March 21, 2023 at 12:41 pm Basic routing using REQUEST_URI…
  • March 16, 2023 at 4:49 pm 404 Fallback comes to Lamb I've added a 40…
  • March 15, 2023 at 12:42 pm Alright got the webserver configuration fi…