Commit Graph

122 Commits (1487e0a1e9b753b53e95e1669ed996306bee71a0)

Author SHA1 Message Date
iambumblehead f5fcde33ec
chore(tools): apply prettier-format to all files (#1077)
Co-authored-by: chris <chris@bumblehead.com>
1 year ago
iambumblehead 49c01df531
chore(tools): remove devdependency lodash-es; used once, ~622kB (#1073)
Co-authored-by: chris <chris@bumblehead.com>
1 year ago
iambumblehead 8c67f426b6
fix: patching namespaced attributes (#1049) (#1061)
Co-authored-by: chris <chris@bumblehead.com>
1 year ago
Jan van Brügge 0a4fb34ffa
chore(test): move from deprecated karma to web-test-runner for browser tests (#1052) 1 year ago
Eduardo Rosostolato 230aa23a69
fix(fragment): fixed patching fragment nodes (#1015) 3 years ago
nexteditorjs c21d569333
fix: datasets -> dataset (#1020) 3 years ago
Jan van Brügge 9d9275467a
chore(deps): update devDependencies 3 years ago
Jan van Brügge 47ef5c14e9
feat: toVnode is support dataset (#1008)
ISSUES CLOSED: #976

Co-authored-by: DM <dmoosocool@gmail.com>
3 years ago
Jan van Brügge 77d6753dd4
chore(test): remove snabbdom benchmarks
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.
3 years ago
Ryota Kameoka 50ff2db407
feat: support JSX fragments (#974)
ISSUES CLOSED: #560
3 years ago
Ryota Kameoka 35058798ae
feat: allow DocumentFragment as a container 3 years ago
Ryota Kameoka 7e86386292
feat: support DocumentFragment
Snabbdom now can handle `DocumentFragment` via `fragment` function.
https://developer.mozilla.org/docs/Web/API/DocumentFragment

ISSUES CLOSED: #560
3 years ago
Jan van Brügge 5a5cce2161
chore(test): fix tests for string object children (#983) 3 years ago
Toby Mao 19d1d29260
feat: allow String and Number objects to be used as children (#979)
ISSUES FIXED: #977
3 years ago
Jan van Brügge ad80c6ea53
feat: allow symbols as keys (#954)
ISSUES CLOSED: #124
4 years ago
Jan van Brügge 0e34828632
chore(test): make tests run again on older browsers
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
4 years ago
Jan van Brügge 5d5fc5a362
feat: add JSX namespace to jsx factory
This allows the user to use multiple different JSX factory functions in
the same project as each one brings their own types
4 years ago
Jan van Brügge e2a8acab7d
chore(tools): add markdown and import plugin 4 years ago
Jan van Brügge 5a539559ef
chore(refactor): apply eslint hints 4 years ago
Jan van Brügge 37f58835fa
chore(refactor): format code with prettier 4 years ago
Jan van Brügge b7ddb94583
chore(tools): replace webpack with karma-typescript for unit tests
ISSUES CLOSED: #538, #801
4 years ago
Jan van Brügge a1e505370d
chore(refactor): move tests to own folder 4 years ago
Shahar Dawn Or b77cb512f4
refactor(tests): convert to TypeScript (#508)
Closes #293.
Fixes #509.
5 years ago
Noj Vek 7ff8d13b4e snabbdom can be used with jsx/tsx via jsxFactory: jsx 5 years ago
Shahar Or (mightyiam) a907828f12 chore: editorconfig + checker 5 years ago
KWorks 529b46c8ce test: use transitionend instead of settimeout
Fixes #447
6 years ago
paldepind f66f919960 Test that multiple event listeners all receive event and vnode 6 years ago
Marius Muja 6a632c2872 Fix for patching node with text over node with children 6 years ago
Jan van Brügge 2e73a926cd Move to karma, allow to test on browserstack 6 years ago
Jan van Brügge 953a326757 Force page reflow before applying styles 7 years ago
K 3438b74801 Added toVNode domApi test 7 years ago
Andre Staltz d00ae793a6
Support DocumentFragment in toVNode 8 years ago
Caridy 702a0af1e8 fixes issue #306 and others: boolean attributes alignment with HTML 8 years ago
Andre Staltz 4b4a34ad0f Fix toVNode() for comment nodes, lacking some fields
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.
8 years ago
cesare soldini 1826bcd3c6 Bugfix: thunk function called two times
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
8 years ago
caesarsol c37321ca12 Use elm.setAttribute('class', ...) instead of elm.className = ... to make it work in SVGs 8 years ago
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