зеркало из https://github.com/mozilla/pjs.git
Make GetElementsByAttribute compare to the qualified name, like it used to, not
just to the localName. Bug 319421, r+sr=sicking
This commit is contained in:
Родитель
714b309562
Коммит
77ac9e8281
|
@ -505,7 +505,7 @@ nsXULElement::GetElementsByAttribute(const nsAString& aAttribute,
|
|||
this,
|
||||
PR_TRUE,
|
||||
attrAtom,
|
||||
kNameSpaceID_None);
|
||||
kNameSpaceID_Unknown);
|
||||
NS_ENSURE_TRUE(list, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
NS_ADDREF(*aReturn = list);
|
||||
|
|
|
@ -1153,7 +1153,7 @@ nsXULDocument::GetElementsByAttribute(const nsAString& aAttribute,
|
|||
nsnull,
|
||||
PR_TRUE,
|
||||
attrAtom,
|
||||
kNameSpaceID_None);
|
||||
kNameSpaceID_Unknown);
|
||||
NS_ENSURE_TRUE(list, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
NS_ADDREF(*aReturn = list);
|
||||
|
@ -2015,12 +2015,35 @@ nsXULDocument::MatchAttribute(nsIContent* aContent,
|
|||
{
|
||||
NS_PRECONDITION(aContent, "Must have content node to work with!");
|
||||
|
||||
if (aNamespaceID != kNameSpaceID_Unknown) {
|
||||
return aAttrValue.EqualsLiteral("*") ?
|
||||
aContent->HasAttr(aNamespaceID, aAttrName) :
|
||||
aContent->AttrValueIs(aNamespaceID, aAttrName, aAttrValue,
|
||||
eCaseMatters);
|
||||
}
|
||||
|
||||
// Qualified name match. This takes more work.
|
||||
|
||||
PRUint32 count = aContent->GetAttrCount();
|
||||
for (PRUint32 i = 0; i < count; ++i) {
|
||||
const nsAttrName* name = aContent->GetAttrNameAt(i);
|
||||
PRBool nameMatch;
|
||||
if (name->IsAtom()) {
|
||||
nameMatch = name->Atom() == aAttrName;
|
||||
} else {
|
||||
nameMatch = name->NodeInfo()->QualifiedNameEquals(aAttrName);
|
||||
}
|
||||
|
||||
if (nameMatch) {
|
||||
return aAttrValue.EqualsLiteral("*") ||
|
||||
aContent->AttrValueIs(name->NamespaceID(), name->LocalName(),
|
||||
aAttrValue, eCaseMatters);
|
||||
}
|
||||
}
|
||||
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXULDocument::PrepareToLoad(nsISupports* aContainer,
|
||||
const char* aCommand,
|
||||
|
|
Загрузка…
Ссылка в новой задаче