Add elements to element map by 'ref', as well.

This commit is contained in:
waterson%netscape.com 1999-10-08 07:26:14 +00:00
parent 65686e242a
commit e66ef0e374
2 changed files with 26 additions and 6 deletions

View File

@ -1907,6 +1907,11 @@ XULContentSinkImpl::OpenTag(const nsIParserNode& aNode, PRInt32 aNameSpaceID, ns
// Add the element to the XUL document's ID-to-element map.
nsCOMPtr<nsIXULDocument> xuldoc = do_QueryInterface(mDocument);
if (! xuldoc)
return NS_ERROR_UNEXPECTED;
// check for an 'id' attribute
nsAutoString id;
rv = element->GetAttribute(kNameSpaceID_None, kIdAtom, id);
if (NS_FAILED(rv)) return rv;
@ -1923,10 +1928,15 @@ XULContentSinkImpl::OpenTag(const nsIParserNode& aNode, PRInt32 aNameSpaceID, ns
}
if (rv == NS_CONTENT_ATTR_HAS_VALUE) {
nsCOMPtr<nsIXULDocument> xuldoc = do_QueryInterface(mDocument);
if (! xuldoc)
return NS_ERROR_UNEXPECTED;
rv = xuldoc->AddElementForID(id, element);
if (NS_FAILED(rv)) return rv;
}
// ...and a 'ref' attribute
rv = element->GetAttribute(kNameSpaceID_None, kRefAtom, id);
if (NS_FAILED(rv)) return rv;
if (rv == NS_CONTENT_ATTR_HAS_VALUE) {
rv = xuldoc->AddElementForID(id, element);
if (NS_FAILED(rv)) return rv;
}

View File

@ -1907,6 +1907,11 @@ XULContentSinkImpl::OpenTag(const nsIParserNode& aNode, PRInt32 aNameSpaceID, ns
// Add the element to the XUL document's ID-to-element map.
nsCOMPtr<nsIXULDocument> xuldoc = do_QueryInterface(mDocument);
if (! xuldoc)
return NS_ERROR_UNEXPECTED;
// check for an 'id' attribute
nsAutoString id;
rv = element->GetAttribute(kNameSpaceID_None, kIdAtom, id);
if (NS_FAILED(rv)) return rv;
@ -1923,10 +1928,15 @@ XULContentSinkImpl::OpenTag(const nsIParserNode& aNode, PRInt32 aNameSpaceID, ns
}
if (rv == NS_CONTENT_ATTR_HAS_VALUE) {
nsCOMPtr<nsIXULDocument> xuldoc = do_QueryInterface(mDocument);
if (! xuldoc)
return NS_ERROR_UNEXPECTED;
rv = xuldoc->AddElementForID(id, element);
if (NS_FAILED(rv)) return rv;
}
// ...and a 'ref' attribute
rv = element->GetAttribute(kNameSpaceID_None, kRefAtom, id);
if (NS_FAILED(rv)) return rv;
if (rv == NS_CONTENT_ATTR_HAS_VALUE) {
rv = xuldoc->AddElementForID(id, element);
if (NS_FAILED(rv)) return rv;
}