I found that the collapsible region code wasn't working for me today, there was a problem with the way in which it was getting+setting heights when toggling the animation on the click event. After looking at the code I decided that I wasn't a big fan of code behind the collapsible region and came up with the attached patch.
Changes are as follows:
- Class is written in the set and forget method it seemed to be used in, no methods after construct.
- Upgraded the code to YUI 3, now makes full use of YUI nodes and the cool stuff they can do.
- Off loaded CSS class toggling into the animation module instance events.
- Fixed up the way the animation toggled (there is a reverse property... much better than changing to and from each click).
- Fixes the issue with animation and heights whereby elements would override due to crazy heights madness as above.
- Tidied up the jsdocs.
What this doesn't do that could be done.
- This doesn't change the underlying HTML in weblib's print collapsible region function however I am 99% sure half of the HTML it generates is not needed. Not really a problem so I didn't change anything there.
- Clean up the CSS for the structure, only one of the CSS rules is actually relevant, the rest could disappear and not be missed. This could be cleaned up when we migrate the CSS into the base theme.
See what you think of this patch.