Support for max_nodes() via components

Similarly, we can have a max_nodes() implementation that is based on the
components instead of forcing the Locator implementation to walk them.