[w3c/webcomponents] Add an assignedElements() method (#602)

Sometimes we need to know how many elements are provided by the user (for example, in a custom element with a shadowdom creating a slideshow, I need to know how many slides are provided to be able to generate the same number of pagination items).

Trying to use `assignedNodes().length`, I get the wrong data, because as the method name suggests, `assignedNodes()` returns all nodes, including empty text nodes, not just elements nodes.

I'm quite surprised to face the old DOM problems again. Nearly every time, we work on elements, not all nodes. All classic DOM node properties and methods have their elements equivalent (`parentNode` > `parentElement`, `nextSibling` > `nextElementSibling`...).

So I think we need an `assignedElements()` method. Can't see a real use case for just `assignedNodes()`.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/602

Received on Saturday, 5 November 2016 11:46:16 UTC