[Home](./index.md) > [@csstools/css-parser-algorithms](./css-parser-algorithms.md) > [ContainerNodeBaseClass](./css-parser-algorithms.containernodebaseclass.md) > [walk](./css-parser-algorithms.containernodebaseclass.walk.md) ## ContainerNodeBaseClass.walk() method Walks the current node and all its children. **Signature:** ```typescript walk, U extends ContainerNode>(this: U, cb: (entry: { node: ComponentValue; parent: ContainerNode; state?: T; }, index: number | string) => boolean | void, state?: T): false | undefined; ``` ## Parameters
Parameter Type Description
this U
cb (entry: { node: [ComponentValue](./css-parser-algorithms.componentvalue.md); parent: [ContainerNode](./css-parser-algorithms.containernode.md); state?: T; }, index: number \| string) => boolean \| void The callback function to execute for each item. The function receives an object containing the current node (`node`), its parent (`parent`), and an optional `state` object. A second parameter is the index of the current node. The function can return `false` to stop the iteration.
state T _(Optional)_ An optional state object that can be used to pass additional information to the callback function. The state object is cloned for each iteration. This means that changes to the state object are not reflected in the next iteration. However changes are passed down to child node iterations.
**Returns:** false \| undefined `false` if the iteration was halted, `undefined` otherwise.