blob: c7f695edc55c87e0c72f7d833117b38253c24a2f [file] [log] [blame]
/*******************************************************************************
* Copyright: 2004, 2012 1&1 Internet AG, Germany, http://www.1und1.de,
* and EclipseSource
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this
* distribution, and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* 1&1 Internet AG and others - original API and implementation
* EclipseSource - adaptation for the Eclipse Remote Application Platform
******************************************************************************/
rwt.qx.Class.define("rwt.html.EventRegistration",
{
/*
*****************************************************************************
STATICS
*****************************************************************************
*/
statics :
{
/**
* Assign a function to an event.
*
* @type static
* @param vElement {Element} DOM Element
* @param vType {String} Name of the event
* @param vFunction {Function} The pointer to the function to assign
* @return {void}
* @signature function(vElement, vType, vFunction)
*/
addEventListener : rwt.util.Variant.select("qx.client",
{
"mshtml" : function(vElement, vType, vFunction) {
vElement.attachEvent("on" + vType, vFunction);
},
"default" : function(vElement, vType, vFunction) {
vElement.addEventListener(vType, vFunction, false);
}
}),
/**
* Unassign a function from an event.
*
* @type static
* @param vElement {Element} DOM Element
* @param vType {String} Name of the event
* @param vFunction {Function} The pointer to the function to assign
* @signature function(vElement, vType, vFunction)
*/
removeEventListener : rwt.util.Variant.select("qx.client",
{
"mshtml" : function(vElement, vType, vFunction) {
vElement.detachEvent("on" + vType, vFunction);
},
"default" : function(vElement, vType, vFunction) {
vElement.removeEventListener(vType, vFunction, false);
}
})
}
});