Implement adopted callback for custom elements

RESOLVED FIXED in Firefox 58

Status

()

defect
P3
normal
RESOLVED FIXED
5 years ago
3 months ago

People

(Reporter: gkrizsanits, Assigned: jdai)

Tracking

unspecified
mozilla58
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox58 fixed)

Details

(Whiteboard: dom-ce-m3)

Attachments

(1 attachment, 1 obsolete attachment)

Reporter

Description

5 years ago
The spec does not mention this callback yet, but there were numerous talks where everybody agreed that we need this callback.
Reporter

Comment 1

5 years ago
Do you think this callback could end up in the spec soonish? Is there any disagreement about it? Do we know exactly when it should be called? (I'm just trying to decide when would it make sense to start working on this)
Assignee: nobody → gkrizsanits
Flags: needinfo?(annevk)

Comment 2

5 years ago
I think there's still disagreement about whether callbacks should have symbols as names or not. If not, I would expect "adoptedCallback" that is passed the old and new document.
Flags: needinfo?(annevk)
Mark this bug as a duplicate of bug 1293921 since we plan to implement all lifecycle callback in bug 1293921.
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1293921
On a second thought, we decide splitting bug 1293921 into smaller pieces, so re-open this bug for implementing adoptedCallback.
Status: RESOLVED → REOPENED
Resolution: DUPLICATE → ---
Priority: -- → P3
Whiteboard: dom-ce-m3
Assignee

Updated

2 years ago
Assignee: gkrizsanits → jdai
Assignee

Comment 5

2 years ago
Posted patch patch, v1 (obsolete) — Splinter Review
Follow the spec[1] implements adopted callback for custom elements. I only tested on my local, hence, could you give me some feedback about this patch? Thank you.

[1] https://dom.spec.whatwg.org/#concept-node-adopt
Flags: needinfo?(bugs)
Comment on attachment 8905947 [details] [diff] [review]
patch, v1


>+++ b/dom/base/CustomElementRegistry.h
>@@ -35,41 +35,55 @@ class Promise;
> struct LifecycleCallbackArgs
> {
>   nsString name;
>   nsString oldValue;
>   nsString newValue;
>   nsString namespaceURI;
> };
> 
>+struct LifecycleAdoptedCallbackArgs
>+{
>+  nsIDocument* oldDocument;
>+  nsIDocument* newDocument;
>+};
I think these both should be nsCOMPtr<nsIDocument>. And normal coding style would be to
call them mOldDocument and mNewDocument, but I see the previous struct doesn't use that either, so naming is up to you.
Flags: needinfo?(bugs)
Attachment #8905947 - Flags: review+
Assignee

Updated

2 years ago
Keywords: checkin-needed

Comment 8

2 years ago
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/0ad5ea4a3f1c
Implement adopted callback for custom elements. r=smaug
Keywords: checkin-needed

Comment 9

2 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/0ad5ea4a3f1c
Status: REOPENED → RESOLVED
Closed: 3 years ago2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla58
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.