code: function waitForChildCallback (parent, predicate, callback) {
    if (predicate(parent)) {
      callback()
  
      return
    }
  
    const win = parent.ownerDocument.defaultView
  
    if (win.MutationObserver) {
      /**
       * @type {!MutationObserver}
       */
      const observer = new win.MutationObserver(() => {
        if (predicate(parent)) {
          observer.disconnect()
          callback()
        }
      })
  
      observer.observe(parent, {childList: true})
  
      return
    }
  
    const intervalId = win.setInterval(() => {
      if (predicate(parent)) {
        win.clearInterval(intervalId)
        callback()
      }
    }, 5)
  }
docs: Executes `callback` when `predicate(parent)` returns `true`.
  
  @param {!HTMLElement} parent element.
  @param {function(!HTMLElement):boolean} predicate function.
  @param {Function} callback function.