async function loadElement(el) {
  const loaded = new Promise(resolve => el.onload = resolve);
  document.body.appendChild(el);
  await loaded;
}
A helper to append `el` into document and wait for it being loaded.
@param {!Element} el