1
votes

Given the following:

<custom_element_a>
   <custom_element_b></custom_element_b>
</custom_element_a>

Suppose that custom_element_b must always be a direct child of custom_element_a, although custom_element_a can also live on its own.

Are there any best practices that should be followed when implementing custom elements having a dependency relationship such as the above? E.g. should custom_element_b be implemented in the same file as custom_element_a?

1

1 Answers

0
votes

In those cases the most common pattern I see is:

custom-element-a/
    custom-element-a.html
    custom-element-b.html

An example is paper-item, which also includes a paper-item-body and paper-icon-item: https://github.com/PolymerElements/paper-item