Commit Graph

12 Commits (b551d93f3152230f11771178b893cad379971a66)

Author SHA1 Message Date
Shahar Or (mightyiam) b551d93f31 style: enable eslint rule prefer-const 5 years ago
Shahar Dawn Or a2342e6875
style: normalize whitespace (#510) 5 years ago
Shahar Or (mightyiam) dcdde2e869 style: @typescript-eslint/array-type 5 years ago
octuplesakura 0a3bc6fdf4 refact: Small part of the grammar optimization 6 years ago
Yarom Shoval a5b93a7137 VNode key property can be undefined
Because actually it can be undefined:
4adbd971cb/src/vnode.ts (L44)
8 years ago
Shahar Or (mightyiam) 4adbd971cb improvements to VNodeData types 8 years ago
Shahar Or (mightyiam) 9dfa5d6f3c type VNode props (fixes #264) 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
paldepind 27993fcadf Typing for module hooks and `h` data 8 years ago
paldepind f552b0e8ed Tweak types, reduce casting 8 years ago
Andre Staltz 091dc5f961
Migrate from CommonJS modules to ES2015 modules 8 years ago
Andre Staltz 499cd37b06
Migrate source code to TypeScript v2.0 8 years ago