[css-houdini-drafts] [css-layout-api] Incorrect example yielding an array of LayoutFragmentRequests

tabatkins has just created a new issue for https://github.com/w3c/css-houdini-drafts:

== [css-layout-api] Incorrect example yielding an array of LayoutFragmentRequests ==
In [Example 1, section 3.2](https://drafts.css-houdini.org/css-layout-api/#example-64f95bef), the example code of the `layout()` function has the line:

```
const childFragments = yield children.map((child) => {
    return child.layoutNextFragment(childConstraints);
});
```

This is invalid per the spec - it builds up an array of LayoutFragmentRequest objects and yields that, expecting to receive an array of LayoutFragment objects as a result. The spec instead mandates that you have to yield a *single* LayoutFragmentRequest, and it returns a *single* LayoutFragment.  So this needs to be rewritten as:

```
const childFragments = [];
for(child of children) {
  childFragments.push(yield child.layoutNextFragment(childConstraints));
}
```

Please view or discuss this issue at https://github.com/w3c/css-houdini-drafts/issues/752 using your GitHub account

Received on Monday, 9 April 2018 12:36:46 UTC