Skip to content
This repository has been archived by the owner on Jul 26, 2022. It is now read-only.

Parent Child Independence

Jan Miksovsky edited this page Jan 4, 2017 · 7 revisions

Checklist » [DOM Presence](Home#DOM Presence)

✓ Parent/Child Independence

Can you use the component inside any type of parent (host) element, or with any type of child elements?

[This article is a stub, and is not yet complete.]

Unless there is a direct need, it's usually best to design a component such that it can work inside any type of parent element and (if the component has a <slot> to accept children) with any type of child element.

It’s fairly rare to find a component that has no meaning outside the context of a particular host. Even a <li> found outside its normal <ul> or <ol> context will still render as a list item. At a minimum, a component that finds itself inside an unexpected host type should avoid throwing exceptions. Keep in mind that components can be subclassed, so even a compatible host could have an unexpected tag. (See Subclassable.)

Clone this wiki locally