Comment

Comment by xingyzt

QuerySelectorAll is widely supported and you can make your own shorthand for it.

  function $(query) {
    const result = document.querySelectorAll(query)
    if ( result ) {
      if ( result.length > 1 ) {
        return result
      } else {
        return result[0]
      }
    }
  }
parent xingyzt 6 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton