Add `_toArray` and `_forEach` and refactor loops.

Like other helpers, these use the faster, native
implementations when possible.
Allow setting `pac-container` context.

The context is just the class name that gets added
to all containers, since these results  containers
don't reference the current input that's using
them, and they also seem to be shared between
inputs. But since only one container can show at a
time, we can safely set the context class on all
of them.

- Add `_toggleClassName` helper, which uses native
`classList` if possible.