Ported param and type from jQuery 2.1.0 with some modification, bug fixes, code modifications and other maintenance tasks