Extends method taken from JQuery 1.9.0 for use in PouchDB