event-focus-debug.js revision b517f2369a42f0d732929584a134778f1ee7d58e
/**
* Adds bubbling and delegation support to DOM events focus and blur.
*
* @module event
* @submodule event-focus
*/
arrayIndex = Y.Array.indexOf,
}, el]);
} else {
{ capture: true });
}
},
//if (!sub.filter || sub.filter.apply(target, filterArgs)) {
// 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) {
}
}
}
if (!defer) {
this._notify(e);
}
//}
},
var currentTarget = e.currentTarget,
// document.get('ownerDocument') returns null
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
}
}
count--;
}
// 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;
}
}
}
/*
while (target && target !== doc) {
nots.push.apply(nots, notifiers[Y.stamp(target)] || []);
target = target.get('parentNode');
}
nots.push.apply(nots, notifiers[Y.stamp(doc)] || []);
for (i = 0, len = nots.length; i < len; ++i) {
notifier = nots[i];
e.currentTarget = nots[i].currentTarget;
if (notifier.container) {
e.container = notifier.container;
}
notifier.fire(e);
}
}
*/
},
},
},
// For sort during notification phase. Delegate subs should
// notify in subscription order when the fake bubble path is walked.
}
},
}
}, 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 {
}