2
YUI 3.10.3 (build 2fb5187)
3
Copyright 2013 Yahoo! Inc. All rights reserved.
4
Licensed under the BSD License.
5
http://yuilibrary.com/license/
9
var GLOBAL_ENV = YUI.Env;
11
if (!GLOBAL_ENV._ready) {
12
GLOBAL_ENV._ready = function() {
13
GLOBAL_ENV.DOMReady = true;
14
GLOBAL_ENV.remove(YUI.config.doc, 'DOMContentLoaded', GLOBAL_ENV._ready);
17
GLOBAL_ENV.add(YUI.config.doc, 'DOMContentLoaded', GLOBAL_ENV._ready);
20
YUI.add('event-base', function (Y, NAME) {
23
* DOM event listener abstraction layer
25
* @submodule event-base
29
* The domready event fires at the moment the browser's DOM is
30
* usable. In most cases, this is before images are fully
31
* downloaded, allowing you to provide a more responsive user
34
* In YUI 3, domready subscribers will be notified immediately if
35
* that moment has already passed when the subscription is created.
37
* One exception is if the yui.js file is dynamically injected into
38
* the page. If this is done, you must tell the YUI instance that
39
* you did this in order for DOMReady (and window load events) to
40
* fire normally. That configuration option is 'injected' -- set
41
* it to true if the yui.js script is not included inline.
43
* This method is part of the 'event-ready' module, which is a
44
* submodule of 'event'.
49
Y.publish('domready', {
54
if (YUI.Env.DOMReady) {
57
Y.Do.before(function() { Y.fire('domready'); }, YUI.Env, '_ready');
61
* Custom event engine, DOM event listener abstraction layer, synthetic DOM
64
* @submodule event-base
68
* Wraps a DOM event, properties requiring browser abstraction are
69
* fixed here. Provids a security layer when required.
70
* @class DOMEventFacade
71
* @param ev {Event} the DOM event
72
* @param currentTarget {HTMLElement} the element the listener was attached to
73
* @param wrapper {Event.Custom} the custom event wrapper for this DOM event
81
* webkit key remapping required for Safari < 3.1
82
* @property webkitKeymap
91
63277: 34, // page down
92
25: 9, // SHIFT-TAB (Safari provides a different key code in
93
// this case, even though the shiftKey modifier is set)
100
* Returns a wrapped node. Intended to be used on event targets,
101
* so it will return the node's parent if the target is a text
104
* If accessing a property of the node throws an error, this is
105
* probably the anonymous div wrapper Gecko adds inside text
106
* nodes. This likely will only occur when attempting to access
107
* the relatedTarget. In this case, we now return null because
108
* the anonymous div is completely useless and we do not know
109
* what the related target was because we can't even get to
110
* the element's parent node.
115
resolve = function(n) {
120
if (n && 3 == n.nodeType) {
130
DOMEventFacade = function(ev, currentTarget, wrapper) {
132
this._currentTarget = currentTarget;
133
this._wrapper = wrapper || EMPTY;
139
Y.extend(DOMEventFacade, Object, {
144
overrides = this._wrapper.overrides,
148
currentTarget = this._currentTarget;
150
this.altKey = e.altKey;
151
this.ctrlKey = e.ctrlKey;
152
this.metaKey = e.metaKey;
153
this.shiftKey = e.shiftKey;
154
this.type = (overrides && overrides.type) || e.type;
155
this.clientX = e.clientX;
156
this.clientY = e.clientY;
161
// charCode is unknown in keyup, keydown. keyCode is unknown in keypress.
162
// FF 3.6 - 8+? pass 0 for keyCode in keypress events.
163
// Webkit, FF 3.6-8+?, and IE9+? pass 0 for charCode in keydown, keyup.
164
// Webkit and IE9+? duplicate charCode in keyCode.
165
// Opera never sets charCode, always keyCode (though with the charCode).
166
// IE6-8 don't set charCode or which.
167
// All browsers other than IE6-8 set which=keyCode in keydown, keyup, and
168
// which=charCode in keypress.
170
// Moral of the story: (e.which || e.keyCode) will always return the
171
// known code for that key event phase. e.keyCode is often different in
172
// keypress from keydown and keyup.
173
c = e.keyCode || e.charCode;
175
if (ua.webkit && (c in webkitKeymap)) {
181
// Fill in e.which for IE - implementers should always use this over
182
// e.keyCode or e.charCode.
183
this.which = e.which || e.charCode || c;
184
// this.button = e.button;
185
this.button = this.which;
187
this.target = resolve(e.target);
188
this.currentTarget = resolve(currentTarget);
189
this.relatedTarget = resolve(e.relatedTarget);
191
if (e.type == "mousewheel" || e.type == "DOMMouseScroll") {
192
this.wheelDelta = (e.detail) ? (e.detail * -1) : Math.round(e.wheelDelta / 80) || ((e.wheelDelta < 0) ? -1 : 1);
196
this._touch(e, currentTarget, this._wrapper);
200
stopPropagation: function() {
201
this._event.stopPropagation();
202
this._wrapper.stopped = 1;
206
stopImmediatePropagation: function() {
208
if (e.stopImmediatePropagation) {
209
e.stopImmediatePropagation();
211
this.stopPropagation();
213
this._wrapper.stopped = 2;
217
preventDefault: function(returnValue) {
220
e.returnValue = returnValue || false;
221
this._wrapper.prevented = 1;
225
halt: function(immediate) {
227
this.stopImmediatePropagation();
229
this.stopPropagation();
232
this.preventDefault();
237
DOMEventFacade.resolve = resolve;
238
Y.DOM2EventFacade = DOMEventFacade;
239
Y.DOMEventFacade = DOMEventFacade;
244
* @type {Native DOM Event}
249
The name of the event (e.g. "click")
256
`true` if the "alt" or "option" key is pressed.
263
`true` if the shift key is pressed.
270
`true` if the "Windows" key on a Windows keyboard, "command" key on an
271
Apple keyboard, or "meta" key on other keyboards is pressed.
278
`true` if the "Ctrl" or "control" key is pressed.
285
* The X location of the event on the page (including scroll)
291
* The Y location of the event on the page (including scroll)
297
* The X location of the event in the viewport
303
* The Y location of the event in the viewport
309
* The keyCode for key events. Uses charCode if keyCode is not available
315
* The charCode for key events. Same as keyCode
321
* The button that was pushed. 1 for left click, 2 for middle click, 3 for
322
* right click. This is only reliably populated on `mouseup` events.
328
* The button that was pushed. Same as button.
334
* Node reference for the targeted element
340
* Node reference for the element that the listener was attached to.
341
* @property currentTarget
346
* Node reference to the relatedTarget
347
* @property relatedTarget
352
* Number representing the direction and velocity of the movement of the mousewheel.
353
* Negative is down, the higher the number, the faster. Applies to the mousewheel event.
354
* @property wheelDelta
359
* Stops the propagation to the next bubble target
360
* @method stopPropagation
364
* Stops the propagation to the next bubble target and
365
* prevents any additional listeners from being exectued
366
* on the current target.
367
* @method stopImmediatePropagation
371
* Prevents the event's default behavior
372
* @method preventDefault
373
* @param returnValue {string} sets the returnValue of the event to this value
374
* (rather than the default false value). This can be used to add a customized
375
* confirmation query to the beforeunload event).
379
* Stops the event propagation and prevents the default
382
* @param immediate {boolean} if true additional listeners
383
* on the current target will not be executed
388
* The event utility provides functions to add and remove event listeners,
389
* event cleansing. It also tries to automatically remove listeners it
390
* registers during the unload event.
393
* @submodule event-base
397
* The event utility provides functions to add and remove event listeners,
398
* event cleansing. It also tries to automatically remove listeners it
399
* registers during the unload event.
405
Y.Env.evt.dom_wrappers = {};
406
Y.Env.evt.dom_map = {};
408
var _eventenv = Y.Env.evt,
412
remove = YUI.Env.remove,
414
onLoad = function() {
415
YUI.Env.windowLoaded = true;
417
remove(win, "load", onLoad);
420
onUnload = function() {
424
EVENT_READY = 'domready',
426
COMPAT_ARG = '~yui|2|compat~',
428
shouldIterate = function(o) {
430
// TODO: See if there's a more performant way to return true early on this, for the common case
431
return (o && typeof o !== "string" && Y.Lang.isNumber(o.length) && !o.tagName && !Y.DOM.isWindow(o));
437
// aliases to support DOM event subscription clean up when the last
438
// subscriber is detached. deleteAndClean overrides the DOM event's wrapper
439
// CustomEvent _delete method.
440
_ceProtoDelete = Y.CustomEvent.prototype._delete,
441
_deleteAndClean = function(s) {
442
var ret = _ceProtoDelete.apply(this, arguments);
444
if (!this.hasSubs()) {
445
Y.Event._clean(this);
454
* True after the onload event has fired
455
* @property _loadComplete
460
var _loadComplete = false,
463
* The number of times to poll after window.onload. This number is
464
* increased if additional late-bound handlers are requested after
466
* @property _retryCount
473
* onAvailable listeners
481
* Custom event wrappers for DOM events. Key is
482
* 'event:' + Element uid stamp + event type
483
* @property _wrappers
484
* @type Y.Event.Custom
488
_wrappers = _eventenv.dom_wrappers,
490
_windowLoadKey = null,
493
* Custom event wrapper map DOM events. Key is
494
* Element uid stamp. Each item is a hash of custom event
495
* wrappers as provided in the _wrappers collection. This
496
* provides the infrastructure for getListeners.
497
* @property _el_events
501
_el_events = _eventenv.dom_map;
506
* The number of times we should look for elements that are not
507
* in the DOM at the time the event is requested after the document
508
* has been loaded. The default is 1000@amp;40 ms, so it will poll
509
* for 40 seconds or until all outstanding handlers are bound
510
* (whichever comes first).
511
* @property POLL_RETRYS
519
* The poll interval in milliseconds
520
* @property POLL_INTERVAL
528
* addListener/removeListener can throw errors in unexpected scenarios.
529
* These errors are suppressed, the method returns false, and this property
531
* @property lastError
540
* @property _interval
547
* document readystate poll handle
555
* True when the document is initially usable
563
* @method startInterval
567
startInterval: function() {
568
if (!Event._interval) {
569
Event._interval = setInterval(Event._poll, Event.POLL_INTERVAL);
574
* Executes the supplied callback when the item with the supplied
575
* id is found. This is meant to be used to execute behavior as
576
* soon as possible as the page loads. If you use this after the
577
* initial page load it will poll for a fixed time for the element.
578
* The number of times it will poll and the frequency are
579
* configurable. By default it will poll for 10 seconds.
581
* <p>The callback is executed with a single parameter:
582
* the custom object parameter, if provided.</p>
584
* @method onAvailable
586
* @param {string||string[]} id the id of the element, or an array
587
* of ids to look for.
588
* @param {function} fn what to execute when the element is found.
589
* @param {object} p_obj an optional object to be passed back as
591
* @param {boolean|object} p_override If set to true, fn will execute
592
* in the context of p_obj, if set to an object it
593
* will execute in the context of that object
594
* @param checkContent {boolean} check child node readiness (onContentReady)
596
* @deprecated Use Y.on("available")
598
// @TODO fix arguments
599
onAvailable: function(id, fn, p_obj, p_override, checkContent, compat) {
601
var a = Y.Array(id), i, availHandle;
604
for (i=0; i<a.length; i=i+1) {
609
override: p_override,
610
checkReady: checkContent,
614
_retryCount = this.POLL_RETRYS;
616
// We want the first test to be immediate, but async
617
setTimeout(Event._poll, 0);
619
availHandle = new Y.EventHandle({
621
_delete: function() {
622
// set by the event system for lazy DOM listeners
623
if (availHandle.handle) {
624
availHandle.handle.detach();
630
// otherwise try to remove the onAvailable listener(s)
631
for (i = 0; i < a.length; i++) {
632
for (j = 0; j < _avail.length; j++) {
633
if (a[i] === _avail[j].id) {
646
* Works the same way as onAvailable, but additionally checks the
647
* state of sibling elements to determine if the content of the
648
* available element is safe to modify.
650
* <p>The callback is executed with a single parameter:
651
* the custom object parameter, if provided.</p>
653
* @method onContentReady
655
* @param {string} id the id of the element to look for.
656
* @param {function} fn what to execute when the element is ready.
657
* @param {object} obj an optional object to be passed back as
659
* @param {boolean|object} override If set to true, fn will execute
660
* in the context of p_obj. If an object, fn will
661
* exectute in the context of that object
664
* @deprecated Use Y.on("contentready")
666
// @TODO fix arguments
667
onContentReady: function(id, fn, obj, override, compat) {
668
return Event.onAvailable(id, fn, obj, override, true, compat);
672
* Adds an event listener
676
* @param {String} type The type of event to append
677
* @param {Function} fn The method the event invokes
678
* @param {String|HTMLElement|Array|NodeList} el An id, an element
679
* reference, or a collection of ids and/or elements to assign the
681
* @param {Object} context optional context object
682
* @param {Boolean|object} args 0..n arguments to pass to the callback
683
* @return {EventHandle} an object to that can be used to detach the listener
688
attach: function(type, fn, el, context) {
689
return Event._attach(Y.Array(arguments, 0, true));
692
_createWrapper: function (el, type, capture, compat, facade) {
696
key = 'event:' + ek + type;
698
if (false === facade) {
706
cewrapper = _wrappers[key];
711
cewrapper = Y.publish(key, {
715
contextFn: function() {
719
cewrapper.nodeRef = cewrapper.nodeRef || Y.one(cewrapper.el);
720
return cewrapper.nodeRef;
725
cewrapper.overrides = {};
727
// for later removeListener calls
730
cewrapper.domkey = ek;
731
cewrapper.type = type;
732
cewrapper.fn = function(e) {
733
cewrapper.fire(Event.getEvent(e, el, (compat || (false === facade))));
735
cewrapper.capture = capture;
737
if (el == win && type == "load") {
738
// window load happens once
739
cewrapper.fireOnce = true;
740
_windowLoadKey = key;
742
cewrapper._delete = _deleteAndClean;
744
_wrappers[key] = cewrapper;
745
_el_events[ek] = _el_events[ek] || {};
746
_el_events[ek][key] = cewrapper;
748
add(el, type, cewrapper.fn, capture);
755
_attach: function(args, conf) {
758
handles, oEl, cewrapper, context,
759
fireNow = false, ret,
763
facade = conf && conf.facade,
764
capture = conf && conf.capture,
765
overrides = conf && conf.overrides;
767
if (args[args.length-1] === COMPAT_ARG) {
771
if (!fn || !fn.call) {
772
// throw new TypeError(type + " attach call failed, callback undefined");
776
// The el argument can be an array of elements or element ids.
777
if (shouldIterate(el)) {
781
Y.each(el, function(v, k) {
783
handles.push(Event._attach(args.slice(), conf));
786
// return (handles.length === 1) ? handles[0] : handles;
787
return new Y.EventHandle(handles);
789
// If the el argument is a string, we assume it is
790
// actually the id of the element. If the page is loaded
791
// we convert el to the actual element, otherwise we
792
// defer attaching the event until the element is
794
} else if (Y.Lang.isString(el)) {
796
// oEl = (compat) ? Y.DOM.byId(el) : Y.Selector.query(el);
799
oEl = Y.DOM.byId(el);
802
oEl = Y.Selector.query(el);
804
switch (oEl.length) {
813
return Event._attach(args, conf);
821
// Not found = defer adding the event until the element is available
824
ret = Event.onAvailable(el, function() {
826
ret.handle = Event._attach(args, conf);
828
}, Event, true, false, compat);
835
// Element should be an html element or node
840
if (Y.Node && Y.instanceOf(el, Y.Node)) {
841
el = Y.Node.getDOMNode(el);
844
cewrapper = Event._createWrapper(el, type, capture, compat, facade);
846
Y.mix(cewrapper.overrides, overrides);
849
if (el == win && type == "load") {
851
// if the load is complete, fire immediately.
852
// all subscribers, including the current one
854
if (YUI.Env.windowLoaded) {
865
// set context to the Node if not specified
866
// ret = cewrapper.on.apply(cewrapper, trimmedArgs);
867
ret = cewrapper._on(fn, context, (args.length > 4) ? args.slice(4) : null);
878
* Removes an event listener. Supports the signature the event was bound
879
* with, but the preferred way to remove listeners is using the handle
880
* that is returned when using Y.on
884
* @param {String} type the type of event to remove.
885
* @param {Function} fn the method the event invokes. If fn is
886
* undefined, then all event handlers for the type of event are
888
* @param {String|HTMLElement|Array|NodeList|EventHandle} el An
889
* event handle, an id, an element reference, or a collection
890
* of ids and/or elements to remove the listener from.
891
* @return {boolean} true if the unbind was successful, false otherwise.
894
detach: function(type, fn, el, obj) {
896
var args=Y.Array(arguments, 0, true), compat, l, ok, i,
899
if (args[args.length-1] === COMPAT_ARG) {
904
if (type && type.detach) {
905
return type.detach();
908
// The el argument can be a string
909
if (typeof el == "string") {
911
// el = (compat) ? Y.DOM.byId(el) : Y.all(el);
915
el = Y.Selector.query(el);
923
// return Event.detach.apply(Event, args);
932
return el.detach.apply(el, args);
933
// The el argument can be an array of elements or element ids.
934
} else if (shouldIterate(el)) {
936
for (i=0, l=el.length; i<l; ++i) {
938
ok = ( Y.Event.detach.apply(Y.Event, args) && ok );
944
if (!type || !fn || !fn.call) {
945
return Event.purgeElement(el, false, type);
948
id = 'event:' + Y.stamp(el) + type;
952
return ce.detach(fn);
960
* Finds the event in the window object, the caller's arguments, or
961
* in the arguments of another method in the callstack. This is
962
* executed automatically for events registered through the event
963
* manager, so the implementer should not normally need to execute
964
* this function at all.
966
* @param {Event} e the event parameter from the handler
967
* @param {HTMLElement} el the element the listener was attached to
968
* @return {Event} the event
971
getEvent: function(e, el, noFacade) {
972
var ev = e || win.event;
974
return (noFacade) ? ev :
975
new Y.DOMEventFacade(ev, el, _wrappers['event:' + Y.stamp(el) + e.type]);
979
* Generates an unique ID for the element if it does not already
982
* @param el the element to create the id for
983
* @return {string} the resulting id of the element
986
generateId: function(el) {
987
return Y.DOM.generateID(el);
991
* We want to be able to use getElementsByTagName as a collection
992
* to attach a group of events to. Unfortunately, different
993
* browsers return different types of collections. This function
994
* tests to determine if the object is array-like. It will also
995
* fail if the object is an array, but is empty.
996
* @method _isValidCollection
997
* @param o the object to test
998
* @return {boolean} true if the object is array-like and populated
999
* @deprecated was not meant to be used directly
1003
_isValidCollection: shouldIterate,
1006
* hook up any deferred listeners
1011
_load: function(e) {
1012
if (!_loadComplete) {
1013
_loadComplete = true;
1015
// Just in case DOMReady did not go off for some reason
1018
Y.fire(EVENT_READY);
1021
// Available elements may not have been detected before the
1022
// window load event fires. Try to find them now so that the
1023
// the user is more likely to get the onAvailable notifications
1024
// before the window load notification
1030
* Polling function that runs before the onload event fires,
1031
* attempting to attach to DOM Nodes as soon as they are
1042
if (Y.UA.ie && !YUI.Env.DOMReady) {
1043
// Hold off if DOMReady has not fired and check current
1044
// readyState to protect against the IE operation aborted
1046
Event.startInterval();
1050
Event.locked = true;
1052
// keep trying until after the page is loaded. We need to
1053
// check the page load state prior to trying to bind the
1054
// elements so that we can be certain all elements have been
1055
// tested appropriately
1056
var i, len, item, el, notAvail, executeItem,
1057
tryAgain = !_loadComplete;
1060
tryAgain = (_retryCount > 0);
1066
executeItem = function (el, item) {
1067
var context, ov = item.override;
1070
if (item.override) {
1079
item.fn.call(context, item.obj);
1081
context = item.obj || Y.one(el);
1082
item.fn.apply(context, (Y.Lang.isArray(ov)) ? ov : []);
1089
for (i=0,len=_avail.length; i<len; ++i) {
1091
if (item && !item.checkReady) {
1093
// el = (item.compat) ? Y.DOM.byId(item.id) : Y.one(item.id);
1094
el = (item.compat) ? Y.DOM.byId(item.id) : Y.Selector.query(item.id, null, true);
1097
executeItem(el, item);
1100
notAvail.push(item);
1106
for (i=0,len=_avail.length; i<len; ++i) {
1108
if (item && item.checkReady) {
1110
// el = (item.compat) ? Y.DOM.byId(item.id) : Y.one(item.id);
1111
el = (item.compat) ? Y.DOM.byId(item.id) : Y.Selector.query(item.id, null, true);
1114
// The element is available, but not necessarily ready
1115
// @todo should we test parentNode.nextSibling?
1116
if (_loadComplete || (el.get && el.get('nextSibling')) || el.nextSibling) {
1117
executeItem(el, item);
1121
notAvail.push(item);
1126
_retryCount = (notAvail.length === 0) ? 0 : _retryCount - 1;
1129
// we may need to strip the nulled out items here
1130
Event.startInterval();
1132
clearInterval(Event._interval);
1133
Event._interval = null;
1136
Event.locked = false;
1143
* Removes all listeners attached to the given element via addListener.
1144
* Optionally, the node's children can also be purged.
1145
* Optionally, you can specify a specific type of event to remove.
1146
* @method purgeElement
1147
* @param {HTMLElement} el the element to purge
1148
* @param {boolean} recurse recursively purge this element's children
1149
* as well. Use with caution.
1150
* @param {string} type optional type of listener to purge. If
1151
* left out, all listeners will be removed
1154
purgeElement: function(el, recurse, type) {
1155
// var oEl = (Y.Lang.isString(el)) ? Y.one(el) : el,
1156
var oEl = (Y.Lang.isString(el)) ? Y.Selector.query(el, null, true) : el,
1157
lis = Event.getListeners(oEl, type), i, len, children, child;
1159
if (recurse && oEl) {
1161
children = Y.Selector.query('*', oEl);
1162
len = children.length;
1163
for (i = 0; i < len; ++i) {
1164
child = Event.getListeners(children[i], type);
1166
lis = lis.concat(child);
1172
for (i = 0, len = lis.length; i < len; ++i) {
1180
* Removes all object references and the DOM proxy subscription for
1181
* a given event for a DOM node.
1184
* @param wrapper {CustomEvent} Custom event proxy for the DOM
1190
_clean: function (wrapper) {
1191
var key = wrapper.key,
1192
domkey = wrapper.domkey;
1194
remove(wrapper.el, wrapper.type, wrapper.fn, wrapper.capture);
1195
delete _wrappers[key];
1196
delete Y._yuievt.events[key];
1197
if (_el_events[domkey]) {
1198
delete _el_events[domkey][key];
1199
if (!Y.Object.size(_el_events[domkey])) {
1200
delete _el_events[domkey];
1206
* Returns all listeners attached to the given element via addListener.
1207
* Optionally, you can specify a specific type of event to return.
1208
* @method getListeners
1209
* @param el {HTMLElement|string} the element or element id to inspect
1210
* @param type {string} optional type of listener to return. If
1211
* left out, all listeners will be returned
1212
* @return {CustomEvent} the custom event wrapper for the DOM event(s)
1215
getListeners: function(el, type) {
1216
var ek = Y.stamp(el, true), evts = _el_events[ek],
1217
results=[] , key = (type) ? 'event:' + ek + type : null,
1218
adapters = _eventenv.plugins;
1225
// look for synthetic events
1226
if (adapters[type] && adapters[type].eventDef) {
1231
results.push(evts[key]);
1234
// get native events as well
1237
results.push(evts[key]);
1241
Y.each(evts, function(v, k) {
1246
return (results.length) ? results : null;
1250
* Removes all listeners registered by pe.event. Called
1251
* automatically during the unload event.
1256
_unload: function(e) {
1257
Y.each(_wrappers, function(v, k) {
1258
if (v.type == 'unload') {
1263
remove(win, "unload", onUnload);
1267
* Adds a DOM event directly without the caching, cleanup, context adj, etc
1270
* @param {HTMLElement} el the element to bind the handler to
1271
* @param {string} type the type of event handler
1272
* @param {function} fn the callback to invoke
1273
* @param {boolen} capture capture or bubble phase
1280
* Basic remove listener
1282
* @method nativeRemove
1283
* @param {HTMLElement} el the element to bind the handler to
1284
* @param {string} type the type of event handler
1285
* @param {function} fn the callback to invoke
1286
* @param {boolen} capture capture or bubble phase
1290
nativeRemove: remove
1297
if (config.injected || YUI.Env.windowLoaded) {
1300
add(win, "load", onLoad);
1303
// Process onAvailable/onContentReady items when when the DOM is ready in IE
1305
Y.on(EVENT_READY, Event._poll);
1309
add(win, "unload", onUnload);
1311
/*jshint maxlen:300*/
1314
Event.Custom = Y.CustomEvent;
1315
Event.Subscriber = Y.Subscriber;
1316
Event.Target = Y.EventTarget;
1317
Event.Handle = Y.EventHandle;
1318
Event.Facade = Y.EventFacade;
1325
* DOM event listener abstraction layer
1327
* @submodule event-base
1331
* Executes the callback as soon as the specified element
1332
* is detected in the DOM. This function expects a selector
1333
* string for the element(s) to detect. If you already have
1334
* an element reference, you don't need this event.
1336
* @param type {string} 'available'
1337
* @param fn {function} the callback function to execute.
1338
* @param el {string} an selector for the element(s) to attach
1339
* @param context optional argument that specifies what 'this' refers to.
1340
* @param args* 0..n additional arguments to pass on to the callback function.
1341
* These arguments will be added after the event object.
1342
* @return {EventHandle} the detach handle
1345
Y.Env.evt.plugins.available = {
1346
on: function(type, fn, id, o) {
1347
var a = arguments.length > 4 ? Y.Array(arguments, 4, true) : null;
1348
return Y.Event.onAvailable.call(Y.Event, id, fn, o, a);
1353
* Executes the callback as soon as the specified element
1354
* is detected in the DOM with a nextSibling property
1355
* (indicating that the element's children are available).
1356
* This function expects a selector
1357
* string for the element(s) to detect. If you already have
1358
* an element reference, you don't need this event.
1359
* @event contentready
1360
* @param type {string} 'contentready'
1361
* @param fn {function} the callback function to execute.
1362
* @param el {string} an selector for the element(s) to attach.
1363
* @param context optional argument that specifies what 'this' refers to.
1364
* @param args* 0..n additional arguments to pass on to the callback function.
1365
* These arguments will be added after the event object.
1366
* @return {EventHandle} the detach handle
1369
Y.Env.evt.plugins.contentready = {
1370
on: function(type, fn, id, o) {
1371
var a = arguments.length > 4 ? Y.Array(arguments, 4, true) : null;
1372
return Y.Event.onContentReady.call(Y.Event, id, fn, o, a);
1377
}, '3.10.3', {"requires": ["event-custom-base"]});