function text (el, contents) {
  if (el.textContent) {
    el.textContent = contents;
  } else {
    el.innerText = contents;
  }
}
Set an element's text contents.

@param {HTMLElement} el
@param {string} contents