From 3ac334fdb12b4b48930f9340b47bba7105114413 Mon Sep 17 00:00:00 2001 From: "nisheeth%netscape.com" Date: Mon, 26 Jun 2000 21:05:16 +0000 Subject: [PATCH] r=vidur, jst. Fix for bug 9076. The nodeName property is now case sensitive for XHTML elements and folded to uppercase for HTML elements. git-svn-id: svn://10.0.0.236/trunk@73249 18797224-902f-48f8-a5cc-f745e15eee43 --- .../html/content/src/nsGenericHTMLElement.cpp | 18 +++++++++++++----- .../html/content/src/nsGenericHTMLElement.cpp | 18 +++++++++++++----- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/mozilla/content/html/content/src/nsGenericHTMLElement.cpp b/mozilla/content/html/content/src/nsGenericHTMLElement.cpp index 3206ed1bb97..1cdb1d6daa6 100644 --- a/mozilla/content/html/content/src/nsGenericHTMLElement.cpp +++ b/mozilla/content/html/content/src/nsGenericHTMLElement.cpp @@ -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); } } diff --git a/mozilla/layout/html/content/src/nsGenericHTMLElement.cpp b/mozilla/layout/html/content/src/nsGenericHTMLElement.cpp index 3206ed1bb97..1cdb1d6daa6 100644 --- a/mozilla/layout/html/content/src/nsGenericHTMLElement.cpp +++ b/mozilla/layout/html/content/src/nsGenericHTMLElement.cpp @@ -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); } }