Skip to content

1.2.0

Choose a tag to compare

@vrtexe vrtexe released this 15 Nov 13:57
· 78 commits to main since this release

This release fixes how props, attributes and children are applied, and adds an experimental plugin hook that the upcoming @fiorejs/signals and @fiorejs/jsx packages build on. Some fixes change behaviour; check the list under "Behaviour changes" before upgrading.

Behaviour changes

  • Attribute values are passed through. 0 and '' are now set; 1.1.5 skipped every falsy value. null and undefined remove the attribute. false removes it too, except for aria-*, data-* and enumerated attributes such as draggable, where it is written as "false".
  • Inline handler attributes are ignored. An attribute that is a real event handler of the element, such as onclick in any case, is never set, so no handler string is run. Other names that start with on, such as online, are set. Use event for listeners.
  • Children are kept when none are given. An element created without children keeps the textContent or innerHTML set through props; 1.1.5 cleared it.
  • null, undefined, true and false children are skipped, so user.isAdmin && badge() works. Numbers are accepted as children.
  • value, selectedIndex and checked are assigned after the attributes and children, so select({ props: { value: 'M' }, children: [...] }) selects the option.
  • Nested props merge only plain objects and their own keys. undefined leaves a property unchanged, and __proto__, constructor and prototype are ignored.
  • MathML elements are created in the MathML namespace; 1.1.5 used the SVG namespace. The MathML a element is deprecated, because TypeScript and MathML Core do not define it.
  • Types: the SVG attribute map no longer accepts arbitrary keys, and value and defaultValue are typed as string | number | null | undefined instead of any.

Added

  • Experimental plugin hook. use(plugin) registers a plugin by name that can bind live values to props, attributes and children. The API may change in a later release. fiorejs warns when it is loaded twice, because plugins registered on one copy do not reach the other.
  • Lists of more than 10,000 children are inserted in chunks instead of one spread call.