Adds debug output.
resize handler will only fire when there is a selection.

This also helps to make sure the `resize` event is usually
fired *after* most other resize handlers.