The problem with the context menu collapse is that the javascript event order in IE9 is different then previous versions. The problem lies in the javascript function Menu_RepaintItem in A573R388.js. When the contextmenu with multiple groups is collapsed, and you are using left or right icons in the parent menu item, it tries to repaint the item and change the left or right icon using the firstchild or lastchild properties. But the parent is already distroyed (and I think the repaint item event should not be fired) and there is no firstchild or lastchild object anymore (this is the javascript error you get).
Because the javascript is obfuscated it is hard to investigate the real problem. So al we did was to put an extra check in the function if the firstchild or lastchild properties is not null. This is really a workaround and not a fix, but it works :). So we change on several places the following check
if (_157.RightIconUrl != null)
to
if ((_157.RightIconUrl != null) && (_157.lastChild != null))
The problem lies in the fact that the parent group is distroyed before the subgroep, and the repaint item function is called on an item which does not exists anymore.
I hope this makes it more clear. As I said it is just a workaround and not really a fix.