The benchmark code was not yet updated to version 3 of snabbdom and
thus cannot be run at the moment. Further, it depends on faker, which is
not available any more. So for now, the benchmark code and all its
dependencies have been removed. In the future we should again add
benchmarks and can reference this commit for some code.
When removing unnecessary dependencies, polyfills like core-js were
removed, as well as webpack which bundled the tests to es5. With this
commit, tests that need specific browser features are skipped if the
browser does not support them and the code is compiled to es5 by
karma-typescript
Comment nodes when converted to VNode were lacking vnode.data and
vnode.elm, which in turn would break use cases with modules such as the
style module (Which assumed vnode.data to be defined). Since toVNode is
used as an initial step (e.g. for server-side rendered content), there
is no reason to not provide vnode.elm since that vnode may be used as
the "prevVNode" during patch. Also, because comment vnodes have the '!'
sel, most logic in snabbdom that detects a truthy sel will also assume a
truthy data field. It is easier to build the comment vnode with those
fields than to modify all the logic elsewhere in snabbdom.
PR #273
* Separate test blocks with newlines
* Add a 🔴 failing test that highlights the bug, and some other more detailed tests on thunk renderings
* Fix the bug ✅
* Correctly gitignore files in base directory
The existing configuration was ignoring the same filenames in subdirectories, for example `test/thunk.js`
* Remove newlines between test blocks
* Make tests titles more explicative
* Performance improvements for attribute patching:
- Avoid call to split and use a object lookup instead
- Simplify the code for `svg` name spaced attributes
* Fix typo and added missing property
* Fixing previous attribute ns assignment
* Refactor NS
* Add fast path for non namespaced elements
* Adding tests
This commit addresses issue #167. Previously, in snabbdom v0.5.0,
patch(element, vnode) would always create a new element for the root.
This resulted in problems with custom elements (web components), and was
fixed in commit c091c59c59.
However, that commit resulted in bug #167. This meant that snabbdom
would have bugs with server-side rendering, where the root element would
be non-empty (it has many children, rendered on the server-side as
HTML), and the client-side rendering should reuse those existing
children (or clear all the children and recreate them again in patch()).
This commit introduces the function toVNode(elm) that deep-converts an
element (and its tree) to a VNode (and its tree), that is separately
imported and used before calling patch(). toVNode(elm) will look at the
element's attributes and gather those as data for the vnode.
Overall, this commit is important for fixing #167 and enabling
client/server-side rendering in an efficient manner
(destruction/recreation client-side is probably too expensive).
This commit makes the patching algorithm ignore `null` and `undefined`
children. This means that, whenever children are iterated, the algorithm
must check for possible `null` and `undefined` values.