src/core/dom/query.js
/**
 * Finds the first child element that satisfies the callback.
 * TODO(rcebulko): Can we start using generators in childElements and defer to
 * that here?
 * @template {Element} El
 * @param {El} parent
 * @param {function(El):boolean} callback
 * @return {?El}
 */
Finds the first child element that satisfies the callback.
TODO(rcebulko): Can we start using generators in childElements and defer to
that here.
Finds the first child element that satisfies the callback . TODO ( rcebulko ) : Can we start using generators in childElements and defer to that here .
function childElement(parent, callback) {
  for (
    let child = parent.firstElementChild;
    child;
    child = child.nextElementSibling
  ) {
    if (callback( (child))) {
      return  (child);
    }
  }
  return null;
}
function childElement ( parent , callback ) { for ( let child = parent . firstElementChild ; child ; child = child . nextElementSibling ) { if ( callback ( ( child ) ) ) { return ( child ) ; } } return null ; }
Finds the first child element that satisfies the callback.
Finds the first child element that satisfies the callback .
/** @type {El} */ /** @type {El} */