hijinks

Tiny DOM builder utility inspired by HyperScript

MIT License

Downloads
14
Stars
8
Committers
1
hijinks - 2.0.3 Latest Release

Published by aduth 4 months ago

Bug Fixes

  • Fix an issue where a boolean child (true or false) is rendered as text.

Optimization

  • Condense and simplify logic (original savings -20b, overall -10b with bug fix):
    • Component test (-10b)
    • Children test (-2b)
    • Fragment appending (-0b createElement, -5b Fragment)
    • Assign props value in initialization (-1b)
    • Simpler boolean comparison (-3b)
    • Use simple loop in append (-4b)
hijinks - v2.0.2

Published by aduth over 3 years ago

TypeScript

  • Fix TypeScript typings for createElement tag and children argument types.
hijinks - v2.0.1

Published by aduth over 3 years ago

Optimization

  • Condense and simplify logic for children normalization (-15b).
hijinks - v2.0.0

Published by aduth over 3 years ago

Breaking Changes

  • The attributes positional argument must always be provided, even if null or undefined.
  • Drop support for Node v10.
  • There is no longer a default export. The createElement function is now a named argument, aliased as h.

New Features

  • Support for fragments via the Fragment export.
  • Add JSX runtime for use with Babel automatic JSX transform.

Enhancements

  • For alignment with similar libraries, children can be passed either as an attribute or as a third argument, or as variadic argument after attributes.
  • Include TypeScript type definitions.

Optimization

  • Shrink bundle size by around 17% in optimal scenarios (with tree-shaking)
  • Simplify append behavior
hijinks - v1.1.0: Components!

Published by aduth over 7 years ago

🚀 New Features

  • Compose reusable components. When passed a function as the first argument, render behavior is deferred to this function; passed attributes including children, the function is expected to return an HTMLElement.

Example:

function Heading( attributes ) {
  return h( 'h' + attributes.level, attributes.children );
}

var element = h( 'div',
  h( Heading, { level: 2 }, 'Example' ),
  'Content'
);
hijinks - v1.0.2: More smaller

Published by aduth over 7 years ago

  • Further optimize children normalization logic, saving 13kb minified / 2kb gzipped (79fd93f1b6e9a694e109129e23eedcf519c8ff60)
hijinks - v1.0.1: npm Repository

Published by aduth over 7 years ago

  • Add repository details to npm package