Issue #577902, fix previous commit. Fix from iamer and jmarco. Introduce handling for jQuery UI 1.7+.