Вы можете получить доступ к собственному DOM из события jQuerys, используя event.originalEvent
, может быть, вы можете найти там связанный объект?Также согласно MDN event.relatedTarget
доступно только для определенных событий.Скопировано из MDN 2018-12-07:
The MouseEvent.relatedTarget read-only property is the secondary target for the mouse event, if there is one.
Event name target relatedTarget
focusin The EventTarget receiving focus The EventTarget losing focus
focusout The EventTarget losing focus The EventTarget receiving focus
mouseenter The EventTarget the pointing device entered to The EventTarget the pointing device exited from
mouseleave The EventTarget the pointing device exited from The EventTarget the pointing device entered to
mouseout The EventTarget the pointing device exited from The EventTarget the pointing device entered to
mouseover The EventTarget the pointing device entered to The EventTarget the pointing device exited from
dragenter The EventTarget the pointing device entered to The EventTarget the pointing device exited from
dragexit The EventTarget the pointing device exited from The EventTarget the pointing device entered to
For events with no secondary target, relatedTarget returns null.
Там нет blur
, но я уверен, что blur
это просто псевдоним для focusout
.
Кроме того, можно напрямую подключиться к ванильному javascript, jQuery переоценен:
editor[0].addEventListener( 'blur', function( event ){
// whatevs
}
(editor[0]
обращается к собственному элементу DOM из возвращенного объекта jQuery)
В противном случае, рефакторинг?