Backing out bug 275196, xml:id, to fix tp regression

This commit is contained in:
2007-07-26 07:16:19 -07:00
parent dcccf53158
commit e7aaf35d8f
27 changed files with 112 additions and 393 deletions

View File

@@ -2260,10 +2260,9 @@ nsGenericElement::DispatchDOMEvent(nsEvent* aEvent,
nsIAtom*
nsGenericElement::GetID() const
{
PRInt32 namespaceID;
nsIAtom* IDName = GetIDAttributeName(namespaceID);
nsIAtom* IDName = GetIDAttributeName();
if (IDName) {
const nsAttrValue* attrVal = mAttrsAndChildren.GetAttr(IDName, namespaceID);
const nsAttrValue* attrVal = mAttrsAndChildren.GetAttr(IDName);
if (attrVal){
if (attrVal->Type() == nsAttrValue::eAtom) {
return attrVal->GetAtomValue();
@@ -2326,26 +2325,9 @@ nsGenericElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
}
nsIAtom *
nsGenericElement::GetIDAttributeName(PRInt32& aNameSpaceID) const
nsGenericElement::GetIDAttributeName() const
{
aNameSpaceID = kNameSpaceID_None;
nsIAtom* idAtom = mNodeInfo->GetIDAttributeAtom();
if (idAtom && HasAttr(aNameSpaceID, idAtom)) {
return idAtom;
}
aNameSpaceID = kNameSpaceID_XML;
return nsGkAtoms::id;
}
PRBool
nsGenericElement::IsPotentialIDAttributeName(PRInt32 aNameSpaceID,
nsIAtom* aAtom) const
{
return (aNameSpaceID == kNameSpaceID_None &&
aAtom == mNodeInfo->GetIDAttributeAtom()) ||
(aNameSpaceID == kNameSpaceID_XML &&
aAtom == nsGkAtoms::id);
return mNodeInfo->GetIDAttributeAtom();
}
nsIAtom *
@@ -3670,8 +3652,8 @@ nsGenericElement::ParseAttribute(PRInt32 aNamespaceID,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (IsPotentialIDAttributeName(aNamespaceID, aAttribute) &&
!aValue.IsEmpty()) {
if (aNamespaceID == kNameSpaceID_None &&
aAttribute == GetIDAttributeName() && !aValue.IsEmpty()) {
// Store id as an atom. id="" means that the element has no id,
// not that it has an emptystring as the id.
aResult.ParseAtom(aValue);