Helpers: For each widget type, record those elements that will become wi...

...dgets of that type before actually instantiating the widgets. Fixes #6621 - Dynamically injected popup with header/footer not enhanced properly.

The problem in #6621 was that the popup gets instantiated before the toolbar (which takes care of the header and the footer). .enhanceWithin() was getting called on a div inside the page. Since the popup relocates its payload such that it is an immediate child of the page, it was relocating the as-yet-unenhanced toolbars outside the scope of the .enhanceWithin() call, so when, later on, .enhanceWithin() started looking for toolbars, it missed the header and the footer.

By breaking the enhancement into two passes, we can capture, for each widget type, all elements that will become widgets of that type, before any other widget type has the opportunity to relocate anything.