Reproduce JQuery functions, tested with Jasmine