- Optimization: try to improve memory usage by refactoring closures.
- Fix:
Array.prototype.splice
no longer reverses inserted elements. - Fix:
Array.prototype.unshift
is no longer broken.
- Fix: internal bug in key sorting order if the corresponding node doesn't exist.
- Fix: ordering of keys in binding should no longer matter.
- Fix: edge case in which unrelated nodes to a CSS selector would be queried and removed.
- Fix: edge case in splicing insertion, which would always append values to the end.
- Fix: edge case in array of objects in which only the last marker in the array would be used.
- Fix: broken edge case for nested parent binding.
- Fix: remove broken feature to pass in a DOM Node in a binding. The reason why a selector must be used is because passing in a DOM Node by reference won't work due to internal use of cloning nodes, it must be possible to get a reference a node based on a selector.
- Fix: optimistically set memoized values everywhere to be consistent.
- Polish: check for
undefined
value in parent change function, replace withnull
.
- Fix: safer escaping in render function when setting attributes.
- Fix:
textarea
should not have value replaced, but rather set its inner text. - Fix: safer escaping in render function.
- Polish: add more element attributes in render function.
- Fix: add
textContent
to rendering DOM subset.
- Optimization: the browser version now strips empty text nodes from the template before processing.
- Benchmark: add a realistic server-side rendering example/benchmark.
- Fix: a few severe bugs fixed in the server-side rendering function.
- Optimization: improve server-side rendering performance by serializing more static nodes.
- Optimization: normalize nodes by default.
- Polish: add entry point for optional helpers at
simulacra/helpers
. - Polish: add
package-lock.json
.
- Refactor: improve packaging.
- Refactor: don't make functions in a loop.
- Feature: add string rendering function for Node.js, to improve performance.
- Fix: allow internal properties to be configured, fixed a problem with rehydration.
- Refactor: remove dependency on
WeakMap
. - Polish: ignore events on child nodes after the parent has been retained.
- Optimization: prefer
appendChild
overinsertBefore
if possible. - Polish: re-use of rehydrated comment nodes.
- Improvement: stricter check for adjacent nodes so that they are not allowed.
- Fix: IE11 compatibility problems.
- Fix: Windows scripting compatibility.
- Polish: include
dist/*.js
in package.
- Breaking change: removed
flow
helper. - Breaking change: removed
setDefault
helper. - Breaking change: removed array indices from
path
argument.
- Fix: default input event binding did not work in some cases.
- Fix: typo in internal function
findTarget
.
- Polish: slightly improve safety of default behavior by checking around the text node.
- Optimization: re-introduce insertion optimization, there was previously a bug that is now fixed.
- Optimization: removed document fragment implementation, it was actually slower.
- Optimization: the default behavior for setting text should be significantly faster.
- Revert: insertion optimizations, they were too fragile.
- Fix: edge case bug when removing objects from an array.
- Optimization: slightly improved insertion performance.
- Polish: when using selector strings, match all elements and remove all but the first one. This makes it more feasible to take a full static page and use it as a template.
- Feature: add optional third argument
node
to main function, which allows for rehydrating from existing DOM. - Polish: animate helper checks if node is already appended to DOM before initializing
MutationObserver
.
- Polish: rename
chain
toflow
, add alias forchain
. This naming is more consistent in behavior from other libraries such as Lodash.
- Polish: auto-detect presence of
content
attribute, useful for selecting template tags.
- Polish: add second argument
path
tobindEvents
event listener functions, useful for changing data within the event listener without a reference to the bound data object.
- Fix:
animate
helper should use MutationObserver to detect DOM insertion. This fixes insert animations in Firefox.
- Polish: add some compatibility checks in the helper functions.
- Feature: add built-in helper functions for common use cases.
- Feature: add
simulacra.setDefault
, as a basic no-op function. - Feature: add
simulacra.bindEvents
, for handling events bound to an element. - Feature: add
simulacra.animate
, for handling animations via CSS classes. - Feature: add
simulacra.chain
, for chaining helper functions.
- Polish: prefer
input
event overchange
in default event binding, which is more synchronous.
- Polish: use boolean checked attribute.
- Feature: inputs and textareas by default set updated values on change, which is a more useful default. Custom change functions may override this.
- Fix: edge case bug where
path.target
is undefined.
- Polish: simplify handling of
undefined
values by casting them all tonull
. - Polish: allow return value in change function that is bound to parent.
- Fix: bug in adjacent node safety check.
- Optimization: prefer
for..in
instead ofObject.keys
.
- Polish: value should not be internally set if there was an error in the change function.
- Optimization: remove unnecessary check in setter function.
- Polish: return value when parent is bound should now be consistent.
- Optimization: remove unnecessary closure, improving performance.
- Fix: allow re-use of bindings again, by internally cloning binding before re-use.
- Feature: shorthand for binding to parent node is now just defining a change function or definition object, no CSS selector string or DOM Node required.
- Fix: disallow re-use of bindings, it doesn't work anyways.
- Fix: error messaging in feature detection.
- Feature: no more mention of mount function, it now has the same signature as change functions.
- Polish: improve feature detection.
- Polish: avoid checking bindings again if they were already used before.
- Polish: freeze bindings for change functions.
- Polish: add test for re-using a binding.
- Fix: bug in
splice
which mutated internal state incorrectly.
- Polish: freeze all bindings.
- Polish: use internal WeakMap for markers instead of hidden property.
- Fix: array mutators on arrays of objects should work.
- Fix: remove checks for already bound objects.
- Polish: freeze bindings after they are used.
- Fix: remove runtime safety checks, they were causing other problems and weren't performant.
- Fix: remove redundant setter call in array mutators.
- Polish: improve runtime safety checks.
- Polish: try to use symbols for internal private properties.
- Polish: internal code deduplication by extracting copied and pasted code into functions.
- Polish: add runtime safety checks for re-assigning bound objects and arrays.
- Fix: edge case in array index setter which would not insert a new node if needed.
- Fix: prevent error in Internet Explorer due to bad DOM API call.
- Fix: do some micro-optimization. Avoid creating document fragments when not needed, and remove internal
checkValue
function.
- Polish: some build tools such as Webpack mangle the function named
define
, this has been renamed internally to avoid compatibility problems with build tools, but this is actually their fault.
- Polish: rename ESLint configuration.
- Fix:
unshift
order was reversed, now inserts in correct order. - Fix:
push
was broken due to subtle variable assignment problem, now fixed.
- Polish: improve performance by using
DocumentFragment
on bulk insertions.
- Polish: add more type checking validations in main function.
- Breaking change: remove
defineBinding
function, now the default exported function does only one thing: binding an object to the DOM. - Breaking change: removed
return false
behavior to retain DOM element, it should instead returnsimulacra.retainElement
. - Feature: change function may accept a return value, which sets
textContent
,value
, orchecked
. Returningundefined
will have no effect. - Polish: rename mutator function to change function.
- Polish: remove redundant logic in mutator function.
- Feature: add mount function for nested definitions as a third argument.
- Fix: use proper variable for checking if target value is array.
- Feature: add
target
on path object. This saves the hassle of always traversing the entire path to the local bound object. - Polish: setting an internal value should work no matter what.
- Polish: use non-enumerable, non-writable private properties.
- Feature: option to use comment nodes instead of empty text nodes, useful for debugging purposes or if
Node.normalize()
is needed.
- Polish: rename internal functions so that they do not conflict with
Function.prototype
.
- Feature: expose
define
andbind
again on the default export.
- Breaking change: the mutator function must return
false
instead of any non-undefined value to prevent the DOM operationremoveChild
.
- Feature: returning any non-undefined value from a mutator function when the Node is about to be removed prevents the automatic call to remove the Node.
- Breaking change: the fourth argument to the mutator function is now a path, instead of index.
- Polish: remove restriction on binding multiple keys to the same DOM node, it wasn't necessary.
- Polish: internal renaming of variables and functions.
- Feature: added support for passing in a string, which is used as the argument for
querySelector
. - Breaking change: removed
define
andbind
on exported function, bypasses type checking in main function.
- Polish: if mutator function throws an error, do not set internal value.
- Polish: remove
parent
property since it is now useless.
- Breaking change: decided that
context
object is a bad idea, it should be as simple as possible. - Polish: differentiate between
undefined
and0
index.
- Feature: expose internal functions
define
andbind
on the default exported function, useful for avoiding dynamic dispatch.