Commit Graph

7 Commits (81da0c124257d393e29796a13e92f6f3016ac20d)

Author SHA1 Message Date
Caridy 702a0af1e8 fixes issue #306 and others: boolean attributes alignment with HTML 8 years ago
paldepind 511b29a6a6 Set boolean attributes correctly according to spec 8 years ago
Andre Staltz a0033a635d
Introduce toVNode() to reconstruct root element as vnode
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).
8 years ago
Caridy 687db9f99b [perf-optimization] skip unnecessary work in modules that can support memoization of the data structure consumed by them 8 years ago
Andre Staltz 091dc5f961
Migrate from CommonJS modules to ES2015 modules 8 years ago
Matt Kaemmerer 7399632795 Add test for namespaced attributes 8 years ago
fix-fix 4fe2f5fedf Add tests for attributes module 9 years ago