nsCOMPtr<nsISupports>	element = dont_AddRef(mRangeArray->ElementAt(0)); nsCOMPtr<nsIDOMRange>	firstRange = do_QueryInterface(element);
nsIDOMRange* firstRange = mRangeArray[0];
nsTypedSelection::CollapseToStart(){  PRInt32 cnt;  nsresult rv = GetRangeCount(&cnt);  if (NS_FAILED(rv) || cnt<=0 || !mRangeArray)		return NS_ERROR_FAILURE;  // Get the first range	nsCOMPtr<nsISupports>	element = dont_AddRef(mRangeArray->ElementAt(0));	nsCOMPtr<nsIDOMRange>	firstRange = do_QueryInterface(element);  if (!firstRange)    return NS_ERROR_FAILURE;  nsCOMPtr<nsIDOMNode> parent;  rv = firstRange->GetStartContainer(getter_AddRefs(parent));  if (NS_SUCCEEDED(rv))  {    if (parent)    {      PRInt32 startOffset;      firstRange->GetStartOffset(&startOffset);      rv = Collapse(parent, startOffset);    } else {      // not very likely!      rv = NS_ERROR_FAILURE;    }  }  return rv;}