Hacker News new | ask | show | jobs
by nostrademons 2658 days ago
That site is from 2012. It defaults to IE9, and the latest version of IE listed is IE10, which was EOLed in 2016. replaceWith() and prepend() are included in Edge 17 (released Apr 2018).

A modern version of youmightnotneedquery with, say, features currently supported by 90%+ browsershare would be even more concise. The AJAX JSON request in the first example, for example, is just:

  fetch('/my/url').then(response => response.json())
The Request example is:

  fetch('/my/url').then(response => ...).catch(error => ...)
The fadeIn example is (CSS3, not JS):

  @keyframes fadeIn {
    from { opacity: 0 }
    to { opacity: 1 }
  }
  #el { animation: fadeIn 1s linear; }
(It gets even easier if you're fading in on hover or other user action, because you can use a CSS transition instead of the animation and then just use .classList.add()).)