Skip to content

[css-layout-api] Incorrect example yielding an array of LayoutFragmentRequests #752

Open
@tabatkins

Description

@tabatkins

In Example 1, section 3.2, 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));
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions