Closed Bug 270640 Opened 20 years ago Closed 20 years ago

Implement DOM 3 isDefaultNamespace()

Categories

(Core :: DOM: Core & HTML, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: smaug, Unassigned)

References

()

Details

Attachments

(1 file, 1 obsolete file)

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.
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+
Attached patch fixSplinter Review
If someone can check this in when the tree is open again.
Attachment #166370 - Attachment is obsolete: true
patch checked in
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
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 :-/
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.

Attachment

General

Created:
Updated:
Size: