Commit Graph

86 Commits (c117be989e5fd4b763281addf794ecfedec508a7)

Author SHA1 Message Date
Diego Ferreiro Val 4ede863df2 Performance improvement for attribute patching: (#257)
* 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
8 years ago
paldepind 511b29a6a6 Set boolean attributes correctly according to spec 8 years ago
Tom Bakker 1a0adb1c95 fix tovnode to ensure text elements can be removed 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
Simon Friis Vindum 9be854410e Merge pull request #232 from nunocastromartins/handle-null-children
Support for null/undefined children
8 years ago
Nuno Martins 367eef52f8 Fix #226. Support for `null`/`undefined` children
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.
8 years ago
Peter Sutherland bb86adef8c Add ability to create comment nodes 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
Simon Friis Vindum 7da866270a Merge pull request #210 from aronallen/fix/ie11svg
use parentNode instead of parentElement
8 years ago
Aron Allen d8bd32f1e5 updated description of test 8 years ago
Aron Allen 166b8eca23 added test 8 years ago
teddddd 72cdb52e1d Fix Custom Element creation when tag name begins with 'svg'
The check at https://github.com/snabbdom/snabbdom/blob/f79af828/src/h.ts#L37
is too loose, and ends up adding the svg namespace to elements with
tagNames such as svg-icon, which prevents web components lifecycle
callbacks from firing.
8 years ago
José Luis Lafuente ccbf30f0c6
Add support for css variables 8 years ago
Simon Friis Vindum cd952ac52f Merge pull request #188 from zhulongzheng/patch
Fix bug of updating one child with same key but different sel.
8 years ago
Alexandre Galays 5a5c0dc121 Allow h(sel, data, node) and h(sel, node) shortcut notations 8 years ago
zhulongzheng 8ffb4eb91a Fix bug of updating one child with same key but different sel 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
Simon Friis Vindum 9a309df04f Merge pull request #161 from fix-fix/fix-boolean-attributes
Don't treat Object.prototype properties as boolean attributes
8 years ago
Andrew Murray 1b48d39e56 Fixed typos 8 years ago
fix-fix 4fe2f5fedf Add tests for attributes module 9 years ago
Andre Staltz c091c59c59 Fix patch() so that the root is patched instead of recreated
Previously, patch(element, vnode) would create a new element every time
for the top-level element, unless the top-level vnode had no id and
className. This is because emptyNodeAt() would create a vnode with sel
equal to the element's tagName, NOT including id and className.

This seems to be just a small fix, however this fix was crucial to get
Web Components (custom elements) working with Cycle.js, because the
custom element's "create" callback was being called infinitely and
recursively, because snabbdom was creating the top-level element every
time, even if the sel of oldVNode and vnode were supposed to be the
same.
9 years ago
Kayo Phoenix 174941c6a4 Added vnode as last argument to event handler 9 years ago
K. 8ca33c916b New implementation of eventlisteners module 9 years ago
Harry Wincup 68d878c274 Additional namespace tests for SVG foreignObject case 9 years ago
paldepind 1ce3cd30d5 Update thunk API and documentation 9 years ago
paldepind 7075aea1d1 New thunk implementation 9 years ago
hville 4ab41ba8d2 Completed tests and matched indendation to spaces 9 years ago
hville 5b164c780a new dataset Module and Test 9 years ago
paldepind a26db8fc5f Only invoke remove hook on root with parent element 9 years ago
paldepind ce14417216 Merge branch 'master' of https://github.com/kay999/snabbdom into replace-root 9 years ago
Ray Di Ciaccio ee00ffa21b When a vnode has 'text' property, remove the text node if vnode ispatched with children. 9 years ago
Ray Di Ciaccio 116950cd5b When a vnode has 'text' property, remove the text node if patched with no 'text'. 9 years ago
Ray Di Ciaccio 0addf72bda Add failing test for iframes. 9 years ago
Sylvain Prat 2279d3cade More tests: nested thunks does not work yet 9 years ago
Sylvain Prat 29eb18108c Repaired broken root init 9 years ago
Sylvain Prat 2341c26e26 Don't assume the root node won't be replaced 9 years ago
Garth Williams 0425b2e5ed Ensure that class, props and style artefacts are not left after re-render 9 years ago
Sylvain Prat 3305f8f253 Fixed tests again 9 years ago
Sylvain Prat 645303e986 Improved/fixed some tests 9 years ago
Sylvain Prat d92dd1f0ce Removed forgotten console.log calls 9 years ago
Sylvain Prat 2f878813b1 Added a bunch of failing tests for thunks 9 years ago
paldepind d0a2f5176e Invoke event listener with several arguments in array #13 10 years ago
paldepind a6a814c9eb Snabbdom will always remove an element from its proper parent, even if the element has been changed 10 years ago
paldepind f72e48dc05 Do not invoke module `remove` hook for text nodes 10 years ago
paldepind 35de88b833 Replace element if it has a parent 10 years ago
paldepind 4c1893423a Add attachTo helper 10 years ago
paldepind 26a62cab4d Add postpatch hook 10 years ago
paldepind 7344b0aca5 Do not invoke `destroy` hook for text nodes 10 years ago
paldepind 24206f430a Add attachTo module 10 years ago