Implement DOM 3 isDefaultNamespace()

RESOLVED FIXED

Status

()

Core
DOM: Core & HTML
RESOLVED FIXED
14 years ago
10 years ago

People

(Reporter: smaug, Unassigned)

Tracking

Trunk
x86
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(1 attachment, 1 obsolete attachment)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8a4) Gecko/20040927
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8a4) Gecko/20040927

Summary says all.
http://lxr.mozilla.org/seamonkey/source/content/base/src/nsGenericElement.cpp#489

Reproducible: Always
Steps to Reproduce:
1.
2.
3.
+also for other Nodes, not only for Element.
Created attachment 166370 [details] [diff] [review]
For Elements, Attributes, Documents and DocumentFragments
(Reporter)

Updated

14 years ago
Attachment #166370 - Flags: superreview?(jst)
Attachment #166370 - Flags: review?(jst)
Comment on attachment 166370 [details] [diff] [review]
For Elements, Attributes, Documents and DocumentFragments

 nsNode3Tearoff::IsDefaultNamespace(const nsAString& aNamespaceURI,
				    PRBool* aReturn)
 {
-  NS_NOTYETIMPLEMENTED("nsNode3Tearoff::IsDefaultNamespace()");
-
-  return NS_ERROR_NOT_IMPLEMENTED;
+  *aReturn = PR_FALSE;
+  nsAutoString defaultNamespace;
+  LookupNamespaceURI(EmptyString(), defaultNamespace);
+  if (aNamespaceURI.Equals(defaultNamespace))
+    *aReturn = PR_TRUE;
+  return NS_OK;

You can eliminate that if check and the initalization of *aReturn to PR_FALSE
there if you write this as:

+  nsAutoString defaultNamespace;
+  LookupNamespaceURI(EmptyString(), defaultNamespace);
+  *aReturn = aNamespaceURI.Equals(defaultNamespace);
+  return NS_OK;

r+sr=jst with that change.
Attachment #166370 - Flags: superreview?(jst)
Attachment #166370 - Flags: superreview+
Attachment #166370 - Flags: review?(jst)
Attachment #166370 - Flags: review+
Created attachment 166378 [details] [diff] [review]
fix

If someone can check this in when the tree is open again.
Attachment #166370 - Attachment is obsolete: true
patch checked in
(Reporter)

Updated

14 years ago
Status: UNCONFIRMED → RESOLVED
Last Resolved: 14 years ago
Resolution: --- → FIXED

Comment 6

14 years ago
Tp on btek regressed ever so slightly after this was checked in.  But, I don't
see anything obvious in this patch that could explain that :-/

Updated

10 years ago
Component: DOM: Core → DOM: Core & HTML
QA Contact: ian → general
You need to log in before you can comment on or make changes to this bug.