Author: pyaschenko
Date: 2010-07-06 06:20:12 -0400 (Tue, 06 Jul 2010)
New Revision: 17733
Modified:
root/core/trunk/impl/src/main/resources/META-INF/resources/richfaces-event.js
Log:
Modified: root/core/trunk/impl/src/main/resources/META-INF/resources/richfaces-event.js
===================================================================
---
root/core/trunk/impl/src/main/resources/META-INF/resources/richfaces-event.js 2010-07-06
10:01:07 UTC (rev 17732)
+++
root/core/trunk/impl/src/main/resources/META-INF/resources/richfaces-event.js 2010-07-06
10:20:12 UTC (rev 17733)
@@ -76,16 +76,16 @@
* @name RichFaces.Event.bind
*
* @param {string|DOMElement|jQuery} selector - jQuery elements selector
- * @param {string} type - one or more JavaScript event types, such as
"click" or "submit," or custom event names
+ * @param {string} eventType - one or more JavaScript event types, such as
"click" or "submit," or custom event names
* @param {function} fn - event handler
* @param {Object} [data] - component or object with additional data
* It is a context for an event handler
* @return {function} function that binded to the element's event
* */
- bind : function(selector, type, fn, component, data) {
- // type: namespace can be used, like onclick.rf.conponentName
+ bind : function(selector, eventType, fn, component, data) {
+ // eventType: namespace can be used, like onclick.rf.conponentName
var f = getHandlerWrapper(component, fn);
- getEventElement(selector).bind(type, data, f);
+ getEventElement(selector).bind(eventType, data, f);
return f;
},
@@ -95,20 +95,20 @@
* @name RichFaces.Event.bindById
*
* @param {string} id - DOM element id
- * @param {string} type - one or more JavaScript event types, such as
"click" or "submit," or custom event names
+ * @param {string} eventType - one or more JavaScript event types, such as
"click" or "submit," or custom event names
* @param {function} fn - event handler
* @param {Object} [data] - component or object with additional data
* It is a context for an event handler
* @return {function} function that binded to the element's event
* */
- bindById : function(id, type, fn, component, data) {
- // type: namespace can be used, like onclick.rf.conponentName
- if (typeof type == "object") {
+ bindById : function(id, eventType, fn, component, data) {
+ // eventType: namespace can be used, like onclick.rf.conponentName
+ if (typeof eventType == "object") {
// in this case fn == component object
- $(document.getElementById(id)).bind(getMultipleHandlerWrapper(type, fn), data);
+ $(document.getElementById(id)).bind(getMultipleHandlerWrapper(eventType, fn), data);
} else {
var f = getHandlerWrapper(component, fn);
- $(document.getElementById(id)).bind(type, data, f);
+ $(document.getElementById(id)).bind(eventType, data, f);
}
return f;
},
@@ -120,16 +120,16 @@
* @name RichFaces.Event.bindOne
*
* @param {string|DOMElement|jQuery} selector - jQuery elements selector
- * @param {string} type - one or more JavaScript event types, such as
"click" or "submit," or custom event names
+ * @param {string} eventType - one or more JavaScript event types, such as
"click" or "submit," or custom event names
* @param {function} fn - event handler
* @param {Object} [data] - component or object with additional data
* It is a context for an event handler
* @return {function} function that binded to the element's event
* */
- bindOne: function(selector, type, fn, component, data) {
- // type: namespace can be used, like onclick.rf.conponentName
+ bindOne: function(selector, eventType, fn, component, data) {
+ // eventType: namespace can be used, like onclick.rf.conponentName
var f = getHandlerWrapper(component, fn);
- getEventElement(selector).one(type, data, f);
+ getEventElement(selector).one(eventType, data, f);
return f;
},
@@ -140,16 +140,16 @@
* @name RichFaces.Event.bindOneById
*
* @param {string} id - DOM element id
- * @param {string} type - one or more JavaScript event types, such as
"click" or "submit," or custom event names
+ * @param {string} eventType - one or more JavaScript event types, such as
"click" or "submit," or custom event names
* @param {function} fn - event handler
* @param {Object} [data] - component or object with additional data
* It is a context for an event handler
* @return {function} function that binded to the element's event
* */
- bindOneById: function(id, type, fn, component, data) {
- // type: namespace can be used, like onclick.rf.conponentName
+ bindOneById: function(id, eventType, fn, component, data) {
+ // eventType: namespace can be used, like onclick.rf.conponentName
var f = getHandlerWrapper(component, fn);
- $(document.getElementById(id)).one(type, data, f);
+ $(document.getElementById(id)).one(eventType, data, f);
return f;
},
@@ -159,13 +159,13 @@
* @name RichFaces.Event.unbind
*
* @param {string|DOMElement|jQuery} selector - jQuery elements selector
- * @param {string} [type] - one or more JavaScript event types, such as
"click" or "submit," or custom event names
+ * @param {string} [eventType] - one or more JavaScript event types, such as
"click" or "submit," or custom event names
* @param {function} [fn] - event handler
* @return {jQuery} element wrapped by jQuery
* */
- unbind : function(selector, type, fn) {
- // type: namespace can be used, like onclick.rf.conponentName
- return getEventElement(selector).unbind(type, fn);
+ unbind : function(selector, eventType, fn) {
+ // eventType: namespace can be used, like onclick.rf.conponentName
+ return getEventElement(selector).unbind(eventType, fn);
},
/**
@@ -175,13 +175,13 @@
* @name RichFaces.Event.unbindById
*
* @param {string} id - DOM element id
- * @param {string} [type] - one or more JavaScript event types, such as
"click" or "submit," or custom event names
+ * @param {string} [eventType] - one or more JavaScript event types, such as
"click" or "submit," or custom event names
* @param {function} [fn] - event handler
* @return {jQuery} element wrapped by jQuery
* */
- unbindById : function(id, type, fn) {
- // type: namespace can be used, like onclick.rf.conponentName
- return $(document.getElementById(id)).unbind(type, fn);
+ unbindById : function(id, eventType, fn) {
+ // eventType: namespace can be used, like onclick.rf.conponentName
+ return $(document.getElementById(id)).unbind(eventType, fn);
},
/**
@@ -190,12 +190,14 @@
* @name RichFaces.Event.fire
*
* @param {string|DOMElement|jQuery} selector - jQuery elements selector
- * @param {string} event - event name
+ * @param {string} eventType - event type
* @param {Object} [data] - a object of additional parameters to pass to the event
handler
* @return {jQuery} element wrapped by jQuery
* */
- fire : function(selector, event, data) {
- return getEventElement(selector).trigger(event, data);
+ fire : function(selector, eventType, data) {
+ var event = $.Event(eventType);
+ getEventElement(selector).trigger(eventType, data);
+ return !event.isDefaultPrevented();
},
/**
@@ -204,12 +206,14 @@
* @name RichFaces.Event.fireById
*
* @param {string} id - DOM element id
- * @param {string} event - event name
+ * @param {string} eventType - event type
* @param {Object} [data] - a object of additional parameters to pass to the event
handler
* @return {jQuery} element wrapped by jQuery
* */
- fireById : function(id, event, data) {
- return $(document.getElementById(id)).trigger(event, data);
+ fireById : function(id, eventType, data) {
+ var event = $.Event(eventType);
+ $(document.getElementById(id)).trigger(event, data);
+ return !event.isDefaultPrevented();
},
/**
@@ -222,12 +226,12 @@
* @name RichFaces.Event.callHandler
*
* @param {string|DOMElement|jQuery} selector - jQuery elements selector
- * @param {string} event - event name
+ * @param {string} eventType - event type
* @param {Object} [data] - a object of additional parameters to pass to the event
handler
* @return value that was returned by the handler
* */
- callHandler : function(selector, event, data) {
- return getEventElement(selector).triggerHandler(event, data);
+ callHandler : function(selector, eventType, data) {
+ return getEventElement(selector).triggerHandler(eventType, data);
},
/**
@@ -236,12 +240,12 @@
* @name RichFaces.Event.callHandlerById
*
* @param {string} id - DOM element id
- * @param {string} event - event name
+ * @param {string} eventType - event type
* @param {Object} [data] - a object of additional parameters to pass to the event
handler
* @return value that was returned by the handler
* */
- callHandlerById : function(id, event, data) {
- return $(document.getElementById(id)).triggerHandler(event, data);
+ callHandlerById : function(id, eventType, data) {
+ return $(document.getElementById(id)).triggerHandler(eventType, data);
},
/**