B2G/gecko/b2g/chrome/content/forms.js
/**
   * Searches upwards in the DOM for an element that has been scrolled.
   *
   * @param {HTMLElement} node element to start search at.
   * @return {Window|HTMLElement|Null} null when none are found window/element otherwise.
   */
Searches upwards in the DOM for an element that has been scrolled.
@param {HTMLElement} node element to start search at.
@return {Window|HTMLElement|Null} null when none are found window/element otherwise.
Searches upwards in the DOM for an element that has been scrolled . @param { HTMLElement } node element to start search at . @return { Window|HTMLElement|Null } null when none are found window / element otherwise .
function fv_findScrolled(node) {
    let win = node.ownerDocument.defaultView;
    while (!(node instanceof HTMLBodyElement)) {
      if (node.scrollTop !== 0) {
         Otherwise it may seem visible but be scrolled out of the viewport
         inside this scrollable node.
        return node;
      } else {
         this node does not effect where we think
         the node is even if it is scrollable it has not hidden
         the element we are looking for.
        node = node.parentNode;
        continue;
      }
    }
     we also care about the window this is the more
     common case where the content is larger then
     the viewport/screen.
    if (win.scrollMaxX || win.scrollMaxY) {
      return win;
    }
    return null;
  }
function fv_findScrolled ( node ) { let win = node . ownerDocument . defaultView ; while ( ! ( node instanceof HTMLBodyElement ) ) { if ( node . scrollTop !== 0 ) { return node ; } else { node = node . parentNode ; continue ; } } if ( win . scrollMaxX || win . scrollMaxY ) { return win ; } return null ; }
Searches upwards in the DOM for an element that has been scrolled.
Searches upwards in the DOM for an element that has been scrolled .
// We can skip elements that have not been scrolled. // We only care about top now remember to add the scrollLeft // check if we decide to care about the X axis. // the element has been scrolled so we may need to adjust // where we think the root element is located. // // Otherwise it may seem visible but be scrolled out of the viewport // inside this scrollable node. // this node does not effect where we think // the node is even if it is scrollable it has not hidden // the element we are looking for. // we also care about the window this is the more // common case where the content is larger then // the viewport/screen.