AUI-946

I believe that @zsagia is encountering the problem described in https://issues.liferay.com/browse/LPS-36484. I'd submitted it to aui master a few months ago, but the codebase changed a lot before it had a chance to be reviewed by @eduardolundgren so it's no longer applicable.

The code as-is still applies to 1.5.x, is this an acceptable solution, or will we need to approach it differently?