event-base-ie.js revision 466fc0d571f1df5f7b889a59f328ffcdcef0d87f
(function() {
var stateChangeListener,
EVENT_NAME = 'onreadystatechange',
GLOBAL_ENV._ieready = function() {
GLOBAL_ENV._ready();
};
// Internet Explorer: use the doScroll() method on the root element.
// This isolates what appears to be a safe moment to manipulate the
// DOM prior to when the document's readyState suggests it is safe to do so.
stateChangeListener = function() {
}
};
} else {
try {
GLOBAL_ENV._dri = null;
} catch (domNotReady) { }
}, pollInterval);
}
}
})();
/*
* Custom event engine, DOM event listener abstraction layer, synthetic DOM
* events.
* @module event
* @submodule event-base
*/
function IEEventFacade() {
// IEEventFacade.superclass.constructor.apply(this, arguments);
}
/*
* (intentially left out of API docs)
* Alternate Facade implementation that is based on Object.defineProperty, which
* is partially supported in IE8. Properties that involve setup work are
* deferred to temporary getters using the static _define method.
*/
function IELazyFacade(e) {
// TODO: necessary?
proxy.hasOwnProperty = function () { return true; };
return proxy;
}
buttonMap = {
2: 3,
4: 2
},
relatedTargetMap = {
mouseout: 'toElement',
mouseover: 'fromElement'
},
proto = {
init: function() {
var e = this._event,
x, y, d, b, de, t;
if (('clientX' in e) && (!x) && (0 !== x)) {
x = e.clientX;
y = e.clientY;
b = d.body;
de = d.documentElement;
this.pageX = x;
this.pageY = y;
}
if (e.type == "mouseout") {
t = e.toElement;
} else if (e.type == "mouseover") {
t = e.fromElement;
}
// fallback to t.relatedTarget to support simulated events.
// IE doesn't support setting toElement or fromElement on generic
// events, so Y.Event.simulate sets relatedTarget instead.
// which should contain the unicode key code if this is a key event
// if (e.charCode) {
// this.which = e.charCode;
// }
// for click events, which is normalized for which mouse button was
// clicked.
if (e.button) {
}
},
stopPropagation: function() {
this._event.cancelBubble = true;
this.stopped = 1;
},
stopImmediatePropagation: function() {
this.stopPropagation();
this.stopped = 2;
},
preventDefault: function(returnValue) {
this.prevented = 1;
}
};
var e = this._event,
prop;
for (prop in lazyProperties) {
}
}
if (this._touch) {
}
};
charCode: function () {
var e = this._event;
},
button: function () {
var e = this._event;
return (e.button) ?
},
target: function () {
},
relatedTarget: function () {
var e = this._event,
// fallback to t.relatedTarget to support simulated events.
// IE doesn't support setting toElement or fromElement on generic
// events, so Y.Event.simulate sets relatedTarget instead.
},
currentTarget: function () {
return resolve(this._currentTarget);
},
wheelDelta: function () {
var e = this._event;
return (e.detail) ?
(e.detail * -1) :
// wheelDelta between -80 and 80 result in -1 or 1
}
},
pageX: function () {
var e = this._event,
}
return val;
},
pageY: function () {
var e = this._event,
}
return val;
}
};
/**
* Wrapper function for Object.defineProperty that creates a property whose
* value will be calulated only when asked for. After calculating the value,
* the getter wll be removed, so it will behave as a normal property beyond that
* point. A setter is also assigned so assigning to the property will clear
* the getter, so foo.prop = 'a'; foo.prop; won't trigger the getter,
* overwriting value 'a'.
*
* Used only by the DOMEventFacades used by IE8 when the YUI configuration
* <code>lazyEventFacade</code> is set to true.
*
* @method _define
* @param o {DOMObject} A DOM object to add the property to
* @param prop {String} The name of the new property
* @param valueFn {Function} The function that will return the initial, default
* value for the property.
* @static
* @private
*/
function val(v) {
delete o[prop];
Object.defineProperty(o, prop, {
configurable: true,
writable: true
});
return ret;
}
Object.defineProperty(o, prop, {
configurable: true
});
};
if (useLazyFacade) {
// Make sure we can use the lazy facade logic
try {
} catch (e) {
useLazyFacade = false;
}
}
}
}, '@VERSION@' );