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
flatten: true in assignedNodes doesn't make much sense when a slot doesn't have display: contents #493
Comments
In addition, when a slot is wrapped another element, e.g. span, it continues to function as a slot. As an example, consider the following tree:
slot C has two assigned nodes: slot A and span. But span also contains slot B. It's not clear as to why slot A needs a special treatment of being unwrapped just because it happens to be a direct child of the shadow host. Or perhaps the importance is that it's a direct child of a slot? |
Yeah, a child of a slot becomes semi-assigned and therefore unwrapped if it's a slot. I'm also not sure we should make this API dependent on layout. There's a difference between what's rendered and what is semantically assigned. |
The API was designed in the era: "slot is not included in the flat tree", to meet the following demand:
In v0, we had |
A slot B does not appear in assignedNode of slot C. Thus, it can be a descendant, but it never be an effective direct child. We do not have to detect any change in any node in the subtree. That's too burden for UAs. What we can do at most for developers here is to tell them the (change of) direct children (in the flat tree). |
Here's a problem. If the span had |
Just layout-wise. We don't let that effect what the actual children are of an element. Whenever we have operations on some element's children, it's always about the node tree, not node tree + some CSS. |
The thing is that the idea of caring about assigned nodes of an assigned slot is about caring about |
No, you only care about |
In that case, we shouldn't have Think about why we need |
@rniwa and I had some discussion on IRC (#whatwg) and concluded that maybe |
I'm fine with the naming of My major concern here is how we should treat Given that, the following might be acceptable:
Does this make sense? |
Indeed, for the DOM only non-layout aspects such as slots matter. For flattened trees |
Okay. Then, the conclusion here is:
However, I am feeling that |
@rniwa @smaug----, thoughts? Not sure I care strongly either way. |
The issue wasn't that the variable name is bad. It was that the semantics doesn't make much sense in the world where a slot doesn't get "unwrapped" when its used style isn't |
Again, you are conflating layout and the DOM I think. The first child of an |
Well, my point is that the very concept of having Why else would one want to have |
It seems to me a way to get all elements that are logically assigned to a slot, without having to do recursion and fallback yourself for any assigned slots. There's no guarantees as to whether anything that is assigned will also be displayed. Some shadow-including ancestor might very well have |
Furthermore, this API might be used in a tree that's not even connected with a browsing context or viewport. |
A slot assigned to another slot is a logically assigned element. Where did you get this whole idea of slots not being inside another slot? If a slot is assigned to another slot, it is IN the slot. I don't understand the basis for unwrapping/flattening any slots. Why on the earth do you want to do such a thing in pure DOM API? |
I didn't say that.
E.g., when you write your own layout engine. |
If you're writing your own layout engine in JS, you might as well as traverse through nodes. Avoiding the work of having to traverse through slots' assigned nodes should be of the least concern. |
Can we make a decision here? My opinion has not changed since #493 (comment). I prefer |
Let's close this issue in status quo. |
When a slot element assigned to another slot has
display
value other thancontents
, it doesn't make much sense to unwrap it inassignedNodes
since those elements would definitely show up in the rendering.The text was updated successfully, but these errors were encountered: