Logo Search packages:      
Sourcecode: xulrunner version File versions  Download package

nsresult nsGenericElement::doQuerySelector ( nsINode aRoot,
const nsAString aSelector,
nsIDOMElement **  aReturn 
) [static, inherited]

Helper methods for implementing querySelector/querySelectorAll

Definition at line 5216 of file nsGenericElement.cpp.

{
  NS_PRECONDITION(aReturn, "Null out param?");

  nsAutoPtr<nsCSSSelectorList> selectorList;
  nsPresContext* presContext;
  nsresult rv = ParseSelectorList(aRoot, aSelector,
                                  getter_Transfers(selectorList),
                                  &presContext);
  NS_ENSURE_SUCCESS(rv, rv);

  nsIContent* foundElement = nsnull;
  TryMatchingElementsInSubtree(aRoot, nsnull, presContext, selectorList,
                               FindFirstMatchingElement, &foundElement);

  if (foundElement) {
    return CallQueryInterface(foundElement, aReturn);
  }

  *aReturn = nsnull;
  return NS_OK;
}


Generated by  Doxygen 1.6.0   Back to index