Repository navigation
v0.7.9
Summary
0.7.9 fixes lifecycle and Light DOM slot defects found in a real 0.7.3 to 0.7.8 migration, adds a lint rule for Custom Elements callbacks overridden without super, and widens two existing checks.
Changes
- Breaking: on every connection, the components inside a component run
connected()before it, in Light DOM and Shadow DOM. A component moved out and back in used to runconnected()before the ones inside it, the reverse of its first start, and a Shadow DOM component ran it before its shadow tree's components even the first time, so a parent that changed a child's elements inconnected()was undone by the child's ownconnected(). - A list or
data-ifof a parent template written directly inside a Light DOM component with slots puts its elements straight into their slot. Before, each update inserted them at the top level of the element and the slot moved them in afterwards: withoutmoveBeforethey were disconnected and connected again (losing focus, runningconnected()twice), also when the slot sat in a container the component keeps out of the document. - A component class's type declares
attributeChangedCallbackand the staticobservedAttributes, so a subclass can extend them withsuper. - New lint rule
callback-without-super(data-flow, warning):connectedCallback,disconnectedCallbackorattributeChangedCallbackoverridden withoutsuper, orobservedAttributesreplaced withoutsuper.observedAttributes, which silently stops the component from starting or from reading props from attributes. constructor-host-changealso reportsthis.insertBefore(...)and instance field initializers that change the element.dom-node-in-stateno longer reports a prop typed as a function that returns nodes.ts-dom doctorfollows a Vite or Vitest config's relative imports to a helper that returnstsDom()before reportingvite-plugin-missing.- Docs: a parent gives a child data through its props, also in its first render;
rules --explain=prop-forwardingsays where the rule does not fit.
Breaking Changes
- The order of
connected()on reconnection and in Shadow DOM components: the components inside now always run it first. Code that relied on a parent'sconnected()running before its children's on reconnection should set the children through their props instead.