Re: [whatwg/dom] "The assignedSlot attribute’s getter must return..." (#369)

@annevk 

> but we don't want to expose a shadow root whose mode is "closed"

Ah, there's the kicker. I knew I was missing something, thanks!

@hayatoito 

> I think the current definition is good enough, letting UA optimize that somehow if they want to do.

@annevk 

> Yeah, it's not immediately obvious to me how to make this better either.

I was thinking of something like:

1. Let *assigned slot* be the context object's assigned slot
2. If *assigned slot* is null, return null
3. If *assigned slot*'s root is a closed shadow root, return null
4. Return *assigned slot*

With the 'find a slot' algorithm, the return due to a closed shadow root can happen earlier, but finding the assigned slot can happen later due to the tree order traversal. With the alternative, the assigned slot is immediately available, but the check for the closed shadow root is from one to **shadow tree depth** steps of traversal. 

But of course I'm not developing a UA so I couldn't even begin to declare one optimal over the other. 🐸 

I **do** think the node removal algorithm should include a provision for setting the node's assigned slot to null, though. Because here:

> 10. If node is assigned, then run assign slotables for node’s assigned slot.

If a node has an assigned slot, and is removed from a shadow host, and then later added to some other node that does not cause it to be assigned a different slot, and then later removed, this algorithm as-is would cause 'assign slotables' to be run for a slot when it didn't need to.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/369#issuecomment-259149875

Received on Tuesday, 8 November 2016 14:27:28 UTC