-
Notifications
You must be signed in to change notification settings - Fork 376
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
Add getAssignedNodes #322
Comments
I don't have a strong opinion on this either. My concern is that the semantics of the At least, I prefer getAssignedNodes to getComposedNodes, which was mentioned at #128. |
Right. The semantics will be same once we stop unwrapping slot (see #308) however. |
#308 is not related since it only affects the composition algorithm, I think. Anyway, I'll rename it to getAssignedNodes unless there is a better proposal. |
Well, it is related in that if #308 gets resolved in the favor of keeping slot elements wrapped, then the get distributed nodes algorithm should also be changed to not flatten the distributed nodes in inner slot elements for consistency since it's quite trivial for authors to unwrap slots manually themselves. |
It's not just renaming. That's yet another proposal, changing the semantics of the getDistributedNodes. I think we should rename this issue, "Replace getDistributedNodes with getAssignedNodes" or "Add getAssignedNodes() API". Anyway, I understand your intention. That' exactly the same API which I thought to add to v1, but I haven't. |
If getAssignedNodes has the new semantics, I don't have any concern about its name. |
Naive question: instead of a function called |
The problem is that WebIDL doesn't allow |
You could use I think the more relevant question is whether this is an O(n) operation (use a method) or O(1) (use a property). |
How does FrozenArray work given the list of assigned nodes change over time? An array is either frozen or not frozen. We shouldn't be modifying a frozen array magically under the hood. If we're creating a new array on that attribute, then it's always O(n) regardless of whether it's a method or an attribute since we have to create a new array on each access. |
You would return a different frozen array whenever it changes, but the same one while it remains the same. |
I haven't really studied the details yet, but if the UA keeps an internal list of assigned nodes a property makes more sense. If it's something that is computed and we just return a snapshot a method makes more sense. |
I've added |
I've not removed getDistributedNodes() yet. |
We should be consistent with the terminology used elsewhere for
slot
attribute andassignedSlot
and call this methodgetAssignedNodes
instead.Introducing new (or historical) terms like "distributed" would only confuse authors.
The text was updated successfully, but these errors were encountered: