Skip to content

v0.7.9

Choose a tag to compare

@github-actions github-actions released this 08 Nov 07:41
6ef5fe5

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 run connected() 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 in connected() was undone by the child's own connected().
  • A list or data-if of 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: without moveBefore they were disconnected and connected again (losing focus, running connected() twice), also when the slot sat in a container the component keeps out of the document.
  • A component class's type declares attributeChangedCallback and the static observedAttributes, so a subclass can extend them with super.
  • New lint rule callback-without-super (data-flow, warning): connectedCallback, disconnectedCallback or attributeChangedCallback overridden without super, or observedAttributes replaced without super.observedAttributes, which silently stops the component from starting or from reading props from attributes.
  • constructor-host-change also reports this.insertBefore(...) and instance field initializers that change the element.
  • dom-node-in-state no longer reports a prop typed as a function that returns nodes.
  • ts-dom doctor follows a Vite or Vitest config's relative imports to a helper that returns tsDom() before reporting vite-plugin-missing.
  • Docs: a parent gives a child data through its props, also in its first render; rules --explain=prop-forwarding says 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's connected() running before its children's on reconnection should set the children through their props instead.