r=vidur, jst. Fix for bug 9076. The nodeName property is now case sensitive for XHTML elements and folded to uppercase for HTML elements.

This commit is contained in:
nisheeth%netscape.com 2000-06-26 21:05:16 +00:00
parent 59cdcf2605
commit 5fc94bfaf5
2 changed files with 26 additions and 10 deletions

View File

@ -456,8 +456,6 @@ nsGenericHTMLElement::GetTagName(nsString& aTagName)
nsresult
nsGenericHTMLElement::GetNodeName(nsString& aNodeName)
{
// This whole method needs revriting to work properly with XHTML...
if (kStrictDOMLevel2) {
mNodeInfo->GetPrefix(aNodeName);
if (aNodeName.Length()) {
@ -467,20 +465,30 @@ nsGenericHTMLElement::GetNodeName(nsString& aNodeName)
nsAutoString tmp;
mNodeInfo->GetName(tmp);
tmp.ToUpperCase();
PRInt32 id;
if (NS_SUCCEEDED(mNodeInfo->GetNamespaceID(id)) && id == kNameSpaceID_None) {
// Only fold to uppercase if the HTML element has no namespace, i.e.,
// it was created as part of an HTML document.
tmp.ToUpperCase();
}
aNodeName.Append(tmp);
} else {
mNodeInfo->GetName(aNodeName);
aNodeName.ToUpperCase();
PRInt32 id;
if (NS_SUCCEEDED(mNodeInfo->GetNamespaceID(id)) && id == kNameSpaceID_None) {
// Only fold to uppercase if the HTML element has no namespace, i.e.,
// it was created as part of an HTML document.
aNodeName.ToUpperCase();
}
}
if (kStrictDOMLevel2) {
PRInt32 pos = aNodeName.FindChar(':');
if (pos >= 0) {
nsCAutoString tmp; tmp.AssignWithConversion(aNodeName);
printf ("Possible DOM Error: .nodeName or .tagName requisted on the HTML alement '%s', is this OK?\n", (const char *)tmp);
printf ("Possible DOM Error: .nodeName or .tagName requested on the HTML element '%s', is this OK?\n", (const char *)tmp);
}
}

View File

@ -456,8 +456,6 @@ nsGenericHTMLElement::GetTagName(nsString& aTagName)
nsresult
nsGenericHTMLElement::GetNodeName(nsString& aNodeName)
{
// This whole method needs revriting to work properly with XHTML...
if (kStrictDOMLevel2) {
mNodeInfo->GetPrefix(aNodeName);
if (aNodeName.Length()) {
@ -467,20 +465,30 @@ nsGenericHTMLElement::GetNodeName(nsString& aNodeName)
nsAutoString tmp;
mNodeInfo->GetName(tmp);
tmp.ToUpperCase();
PRInt32 id;
if (NS_SUCCEEDED(mNodeInfo->GetNamespaceID(id)) && id == kNameSpaceID_None) {
// Only fold to uppercase if the HTML element has no namespace, i.e.,
// it was created as part of an HTML document.
tmp.ToUpperCase();
}
aNodeName.Append(tmp);
} else {
mNodeInfo->GetName(aNodeName);
aNodeName.ToUpperCase();
PRInt32 id;
if (NS_SUCCEEDED(mNodeInfo->GetNamespaceID(id)) && id == kNameSpaceID_None) {
// Only fold to uppercase if the HTML element has no namespace, i.e.,
// it was created as part of an HTML document.
aNodeName.ToUpperCase();
}
}
if (kStrictDOMLevel2) {
PRInt32 pos = aNodeName.FindChar(':');
if (pos >= 0) {
nsCAutoString tmp; tmp.AssignWithConversion(aNodeName);
printf ("Possible DOM Error: .nodeName or .tagName requisted on the HTML alement '%s', is this OK?\n", (const char *)tmp);
printf ("Possible DOM Error: .nodeName or .tagName requested on the HTML element '%s', is this OK?\n", (const char *)tmp);
}
}