/**
* Adds bubbling and delegation support to DOM events focus and blur.
*
* @module event
* @submodule event-focus
*/
arrayIndex = Y.Array.indexOf,
}, el]);
} else {
{ capture: true });
}
},
// Maintain a list to handle subscriptions from nested
// containers div#a>div#b>input #a.on(focus..) #b.on(focus..),
// use one focus or blur subscription that fires notifiers from
// #b then #a to emulate bubble sequence.
if (!notifiers) {
notifiers = {};
// only subscribe to the element's focus if the target is
// not the current target (
if (defer) {
}
} else {
// In old IE, defer is always true. In capture-phase browsers,
// The delegate subscriptions will be encountered first, which
// will establish the notifiers data and direct subscription
// on the node. If there is also a direct subscription to the
// direct subscription from the delegate sub(s) exists, which
// will call _notify. So this avoids _notify being called
// twice, unnecessarily.
defer = true;
}
}
if (!defer) {
this._notify(e);
}
},
var currentTarget = e.currentTarget,
delegates = [],
// Used to escape loops when there are no more
// notifiers to consider
count = notifierData ?
0,
// clear the notifications list (mainly for delegation)
// Order the delegate subs by their placement in the parent axis
// document.get('ownerDocument') returns null
// which we'll use to prevent having duplicate Nodes in the list
if (doc) {
}
// ancestors() returns the Nodes from top to bottom
// Store the count for step 2
i, len;
if (notifiers) {
count--;
}
}
}
return !count;
});
// Walk up the parent axis, notifying direct subscriptions and
// testing delegate filters.
if (notifiers) {
match = true;
e.currentTarget = target;
// No longer necessary to test against this
// delegate subscription for the nodes along
// the parent axis.
}
if (match) {
// undefined for direct subs
}
break;
}
}
count--;
}
if (e.stopped !== 2) {
// delegates come after subs targeting this specific node
// because they would not normally report until they'd
// bubbled to the container node.
e.currentTarget = target;
}
break;
}
}
}
if (e.stopped) {
break;
}
}
},
},
},
};
}
},
}
}, true);
}
// For IE, we need to defer to focusin rather than focus because
// `el.focus(); doSomething();` executes el.onbeforeactivate, el.onactivate,
// el.onfocusin, doSomething, then el.onfocus. All others support capture
// phase focus, which executes before doSomething. To guarantee consistent
// behavior for this use case, IE's direct subscriptions are made against
// focusin so subscribers will be notified before js following el.focus() is
// executed.
if (useActivate) {
// name capture phase direct subscription
} else {
}