diff --git a/zepto/zepto-tests.ts b/zepto/zepto-tests.ts index fc3760f9a..2d85f16c0 100644 --- a/zepto/zepto-tests.ts +++ b/zepto/zepto-tests.ts @@ -306,3 +306,9 @@ $.browser.playbook; !!$.os.ios; // => true !!$.os.version; // => "6.1" !!$.browser.version; // => "536.26" + +// shortcut methods for `.bind(event, fn)` for each event type +$('#example').click(); +$('#example').click(() => { + alert('clicked'); +}); \ No newline at end of file diff --git a/zepto/zepto.d.ts b/zepto/zepto.d.ts index ba75e7556..04f11289e 100644 --- a/zepto/zepto.d.ts +++ b/zepto/zepto.d.ts @@ -1407,6 +1407,75 @@ interface ZeptoCollection { **/ undelegate(selector: string, type: string, fn: (e: Event) => boolean): ZeptoCollection; + focusin(): ZeptoCollection; + focusin(fn: (e: Event) => any): ZeptoCollection; + + focusout(): ZeptoCollection; + focusout(fn: (e: Event) => any): ZeptoCollection; + + load(): ZeptoCollection; + load(fn: (e: Event) => any): ZeptoCollection; + + resize(): ZeptoCollection; + resize(fn: (e: Event) => any): ZeptoCollection; + + scroll(): ZeptoCollection; + scroll(fn: (e: Event) => any): ZeptoCollection; + + unload(): ZeptoCollection; + unload(fn: (e: Event) => any): ZeptoCollection; + + click(): ZeptoCollection; + click(fn: (e: Event) => any): ZeptoCollection; + + dblclick(): ZeptoCollection; + dblclick(fn: (e: Event) => any): ZeptoCollection; + + mousedown(): ZeptoCollection; + mousedown(fn: (e: Event) => any): ZeptoCollection; + + mouseup(): ZeptoCollection; + mouseup(fn: (e: Event) => any): ZeptoCollection; + + mousemove(): ZeptoCollection; + mousemove(fn: (e: Event) => any): ZeptoCollection; + + mouseover(): ZeptoCollection; + mouseover(fn: (e: Event) => any): ZeptoCollection; + + mouseout(): ZeptoCollection; + mouseout(fn: (e: Event) => any): ZeptoCollection; + + mouseenter(): ZeptoCollection; + mouseenter(fn: (e: Event) => any): ZeptoCollection; + + mouseleave(): ZeptoCollection; + mouseleave(fn: (e: Event) => any): ZeptoCollection; + + change(): ZeptoCollection; + change(fn: (e: Event) => any): ZeptoCollection; + + select(): ZeptoCollection; + select(fn: (e: Event) => any): ZeptoCollection; + + keydown(): ZeptoCollection; + keydown(fn: (e: Event) => any): ZeptoCollection; + + keypress(): ZeptoCollection; + keypress(fn: (e: Event) => any): ZeptoCollection; + + keyup(): ZeptoCollection; + keyup(fn: (e: Event) => any): ZeptoCollection; + + error(): ZeptoCollection; + error(fn: (e: Event) => any): ZeptoCollection; + + focus(): ZeptoCollection; + focus(fn: (e: Event) => any): ZeptoCollection; + + blur(): ZeptoCollection; + blur(fn: (e: Event) => any): ZeptoCollection; + /** * Ajax **/