Simulating “focus” and “blur” in jQuery .live() method

前端 未结 6 1665
囚心锁ツ
囚心锁ツ 2020-12-01 02:11

Update: As of jQuery 1.4, $.live() now supports focusin and focusout events.


jQuery currently1 doesn

6条回答
  •  粉色の甜心
    2020-12-01 03:00

    live() is jQuery's shortcut to event delegation. To answer your question, see Delegating the focus and blur events.

    It's pretty ingenious: for standards compliant browsers he uses event capturing to trap those events. For IE he uses IE's proprietary focusin (for focus) and focusout (for blur) events, which do bubble, allowing traditional event delegation.

    I'll leave the porting of it to jQuery as an exercise.

提交回复
热议问题