Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Custom] attachedCallback and detechedCallback should be removed #286

Closed
rniwa opened this issue Jul 21, 2015 · 3 comments
Closed

[Custom] attachedCallback and detechedCallback should be removed #286

rniwa opened this issue Jul 21, 2015 · 3 comments

Comments

@rniwa
Copy link
Collaborator

rniwa commented Jul 21, 2015

In addition #222, attachedCallback and detachedCallback should be removed.

While it's a viable optimization to avoid work in a custom element while the element is not in the document, there is a lot of work that needs to happen regardless of where an element is inserted.

Since the author can easily check the existence of the browsing context by checking document.defaultView or detect whether the element has display: none as the used value or not, there is no need to have a separate callback.

@domenic
Copy link
Collaborator

domenic commented Jul 21, 2015

Hmm, I'm a little confused how this squares with https://lists.w3.org/Archives/Public/public-webapps/2015AprJun/0517.html where (by my reading) @bzbarsky and @coonsta point out that the primitive inside implementations today is in fact the same as attachedCallback and detachedCallback, and @annevk agrees that it's probably best to update the DOM/HTML to work in terms of those concepts.

See especially

So I'm not entirely sure what the proposal is here. Maybe it is for something similar to insertedIntoCallback(Node insertionPoint)/removedFromCallback(Node insertionPoint)? That is not what #222 proposes though. And it does not solve one of the primary use cases of detachedCallback, of telling when you're ancestor is removed from the document, which is used 68 times in Blink's HTML elements.

I could see advocating for the addition of insertedInto/removedFrom, but we'd also need attachedCallback/detachedCallback to handle the HTML spec's many in a document occurrences.

@smaug----
Copy link

The methods in Custom Elements spec certainly aren't the same what Gecko has.
The spec deals only with inserting/removing from a document in a browsing context, but
Gecko at least doesn't care whether there is browsing context and it gets a notification whenever ancestor chain has changed.
As bz said in https://lists.w3.org/Archives/Public/public-webapps/2015AprJun/0577.html

@rniwa
Copy link
Collaborator Author

rniwa commented Mar 1, 2016

This will be resolved in the issue #362.

@rniwa rniwa closed this as completed Mar 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants