Closed Bug 285597 Opened 20 years ago Closed 20 years ago

Implement Get/SetProperty for nsIAttribute

Categories

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

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: allan, Assigned: allan)

References

Details

Attachments

(1 file, 3 obsolete files)

We should let nsIAttribute implement Get/SetProperty(), etc. just as nsIContent.
Attached patch Patch (obsolete) — Splinter Review
Here's a go at it. Doesn't seem to work for me though :(
(In reply to comment #1)
> Created an attachment (id=177015) [edit]
> Patch
> 
> Here's a go at it. Doesn't seem to work for me though :(

Had a chat with peterv about it:
1. the functions in nsIAttribute should abstract.
2. nsDOMAttributes are not unique.... we need to cache them in nsDOMAttributeMap

or: Big monster ate my little bug :)
Status: NEW → ASSIGNED
Blocks: 283004
Attached patch Updated patch (obsolete) — Splinter Review
Bug 235512 is ready, so it's time to get this one done too.
Attachment #177015 - Attachment is obsolete: true
Attachment #183822 - Flags: review?(bugmail)
Comment on attachment 183822 [details] [diff] [review]
Updated patch

>+  nsISupports *thisSupports = NS_STATIC_CAST(nsIDOMAttr*, this);
>+#ifdef DEBUG
>+  printf("GetProperty(this=%p, aPropertyName = %p)\n",
>+         (void*) thisSupports,
>+         (void*) aPropertyName);
>+#endif
>+  return doc->PropertyTable()->GetProperty(thisSupports, aPropertyName,
>+                                           aStatus);

Why all this casting to nsISupports? Just use |this| as first argument
everywhere.

>+  nsIDocument *GetOwnerDoc() const
>+  {
>+    return mContent ? mContent->GetOwnerDoc() : mNodeInfo->GetDocument();
>+  }

You making this a virtual function once mContent dies? Actually, ideally we
should update the mNodeInfo member of all attrnodes when an element is moved
between documents. Then this could just use mNodeInfo->GetDocument(). But that
could be done in another bug.

r=me with the first fixed.
Attachment #183822 - Flags: review?(bugmail) → review+
Attached patch w/sicking's comment (obsolete) — Splinter Review
Attachment #183822 - Attachment is obsolete: true
Attachment #184913 - Flags: superreview?(peterv)
(In reply to comment #5)
> Created an attachment (id=184913) [edit]
> w/sicking's comment

And |doc->PropertyTable()->DeleteAllPropertiesFor(this)| in the dtor btw.
Comment on attachment 184913 [details] [diff] [review]
w/sicking's comment

>Index: content/base/public/nsIAttribute.h
>===================================================================

>+  /* Methods for manipulating content node properties.  For documentation on

Make that 

  /**
   * Methods...
Attachment #184913 - Flags: superreview?(peterv) → superreview+
Attachment #184913 - Flags: approval1.8b3?
Comment on attachment 184913 [details] [diff] [review]
w/sicking's comment

a=mkaply
Attachment #184913 - Flags: approval1.8b3? → approval1.8b3+
Updated to incorporate changes that came from bug 235512.
Attachment #184913 - Attachment is obsolete: true
Attachment #185253 - Flags: superreview?(peterv)
Attachment #185253 - Flags: review?(peterv)
Attachment #185253 - Flags: superreview?(peterv)
Attachment #185253 - Flags: superreview+
Attachment #185253 - Flags: review?(peterv)
Attachment #185253 - Flags: review+
Checked in.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
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

Creator:
Created:
Updated:
Size: