[jQuery] onBlur event problem with Safari, works in FF & IE

[jQuery] onBlur event problem with Safari, works in FF & IE


Hi,
I'm trying to get a onBlur event working in Safari. The problem lies
in getting the triggering element. I have no idea what the problem is.
Using this to get a triggering element:
var _trigger = e.originalEvent.explicitOriginalTarget ||
e.relatedTarget || document.activeElement;
For some reason e.relatedTarget is always undefined (in Safari and FF
anyway).
Does anyone knows if there's a workaround? Is this a bug in webkit/
safari or jQuery?
What I'm want to do is to find if the element that triggered the
onBlur is inside my <div class=""></div> using this code:
$('.search_field').blur(function(e) {
    var _trigger = e.originalEvent.explicitOriginalTarget ||
e.relatedTarget || document.activeElement;
    /** Check if _trigger is really an element **/
_trigger = _trigger.nodeType == 1 ? _trigger :
_trigger.parentNode;
    var isChild = false;
    $('.search_box').find('*').each(function(index, elem) {
        if (_trigger === elem) {
            isChild = true;
        }
    });
    if (!isChild) {
        $('.search_results_box').hide();
    };
});
Also, if anyone got a hit if there's a better way to write this, fell
free.
..fredrik