#4939: Fix issue with wysiwyg not collapsing after browser tab change.

It looks like the scope created by the behavior's attach function is destroyed when the tab changes. I'm not sure what the rules are for which scopes are destroyed and when. By moving the function definition out of this scope and into the parent scope, the problem seems to be resolved.