B2G/gecko/browser/components/places/src/PlacesUIUtils.jsm
/**
   * Returns the closet ancestor places view for the given DOM node
   * @param aNode
   *        a DOM node
   * @return the closet ancestor places view if exists, null otherwsie.
   */
Returns the closet ancestor places view for the given DOM node
@param aNode
a DOM node
@return the closet ancestor places view if exists, null otherwsie.
Returns the closet ancestor places view for the given DOM node @param aNode a DOM node @return the closet ancestor places view if exists null otherwsie .
function PUIU_getViewForNode(aNode) {
    let node = aNode;
    if (node.localName == "menu" && !node._placesNode &&
        node.lastChild._placesView)
      return node.lastChild._placesView;
    while (node instanceof Ci.nsIDOMElement) {
      if (node._placesView)
        return node._placesView;
      if (node.localName == "tree" && node.getAttribute("type") == "places")
        return node;
      node = node.parentNode;
    }
    return null;
  }
function PUIU_getViewForNode ( aNode ) { let node = aNode ; if ( node . localName == "menu" && ! node . _placesNode && node . lastChild . _placesView ) return node . lastChild . _placesView ; while ( node instanceof Ci . nsIDOMElement ) { if ( node . _placesView ) return node . _placesView ; if ( node . localName == "tree" && node . getAttribute ( "type" ) == "places" ) return node ; node = node . parentNode ; } return null ; }
Returns the closet ancestor places view for the given DOM node
 @param aNode
        a DOM node
 @return the closet ancestor places view if exists, null otherwsie.
Returns the closet ancestor places view for the given DOM node @param aNode a DOM node @return the closet ancestor places view if exists null otherwsie .
// The view for a <menu> of which its associated menupopup is a places // view, is the menupopup.