• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

preactjs / preact / 4359
100%

Build:
DEFAULT BRANCH: master
Ran 05 Jun 2019 11:01PM UTC
Jobs 1
Files 22
Run time 2s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
4359

push

travis-ci

web-flow
Consistently use `_children` & combine Fragment and Component diffing (-73 B) (#1658)

## Summary

* Replace `component._prevVNode` with `vnode._children`
* Combine Fragment and Component diffing

## Details

### Replace `component._prevVNode` with `vnode._children`

Previously, `_children` was a cache for a normalized `props.children`. With a DOM VNode and Fragment VNode, you could access the children of the VNodes on the this `_children` property, but on VNodes for components, you need to go through `vnode._component._preVNode`.

This PR formalizes the concept behind `_children`. It is now the container for the rendered children of all VNodes. If you think of `props.children` as input to render functions, `_children` is the output of the `render`. And DOM VNodes and Fragments are just render functions that return `props.children`. The implementation is a little different (DOM VNodes don't have a render function, per se), but this concept applies.

### Combine Fragment and Component diffing

Previously, if `diff` was called with a Component, it would call `c.render`, coerce the result to a single VNode (e.g. convert arrays to a Fragment), and then call `diff`.  However, building on the `_children` change (and the concept mentioned there), we now instead treat Components as always returning arrays, and coerce result of render into a children of VNodes to continue rendering. So, `diff` always calls `diffChildren` after diff'ing a VNode, regardless of its type. Another way to think about this is that everything is Fragment now :smile:

Being able to depend on `diffChildren` -> `diff` -> `diffChildren` for all VNodes allows us to do operations that require knowing the `parentVNode` in `diffChildren` without having to special case the `diff` -> `diff` situation. For example, there is now only one place where oldVNode matching happens: `diffChildren` (we can remove some code from the top of `diff`). Further, mounting and unmounting DOM onl... (continued)

798 of 828 branches covered (96.38%)

886 of 888 relevant lines covered (99.77%)

740.88 hits per line

Jobs
ID Job ID Ran Files Coverage
1 4359.1 05 Jun 2019 11:01PM UTC 0
99.77
Travis Job 4359.1
Source Files on build 4359
  • Tree
  • List 0
  • Changed 15
  • Source Changed 9
  • Coverage Changed 14
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Travis Build #4359
  • b8c0e87c on github
  • Prev Build on master (#4345)
  • Next Build on master (#4365)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc