Skip to main content
The Deno 2 Release Candidate is here
Learn more
Latest
method Container.prototype.walk
Re-export
import { Container } from "https://deno.land/x/postcss@8.4.16/lib/postcss.js";

Traverses the container’s descendant nodes, calling callback for each node.

Like container.each(), this method is safe to use if you are mutating arrays during iteration.

If you only need to iterate through the container’s immediate children, use Container#each.

root.walk(node => {
  // Traverses all descendant nodes.
})

Parameters

callback: (node: ChildNode, index: number) => false | void

Iterator receives each node and index.

Returns

false | undefined

Returns false if iteration was broke.