From e3320195d60c63d84480d7839c0cde8f683bd7b7 Mon Sep 17 00:00:00 2001
From: wei <>
Date: Fri, 5 May 2006 04:17:03 +0000
Subject: Update the Event.fireEvent(element,type) javascript function. Hope
that is works in Safari.
---
framework/Web/Javascripts/extended/event.js | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
(limited to 'framework/Web/Javascripts/extended')
diff --git a/framework/Web/Javascripts/extended/event.js b/framework/Web/Javascripts/extended/event.js
index 13e875da..29a8d5aa 100644
--- a/framework/Web/Javascripts/extended/event.js
+++ b/framework/Web/Javascripts/extended/event.js
@@ -63,13 +63,15 @@ Object.extend(Event,
* Dispatch the DOM event of a given type on a DOM
* element. Only HTMLEvent and MouseEvent can be
* dispatched, keyboard events or UIEvent can not be dispatch
- * via javascript.
+ * via javascript consistently.
* @param {Object} element id string or a DOM element.
* @param {String} event type to dispatch.
*/
fireEvent : function(element,type)
{
element = $(element);
+ if(type == "submit")
+ return element.submit();
if(document.createEvent)
{
if(Event.isHTMLEvent(type))
@@ -86,19 +88,18 @@ Object.extend(Event,
}
else
{
- if(Logger)
+ if(typeof(Logger) != "undefined")
Logger.error("undefined event", type);
return;
}
element.dispatchEvent(event);
}
- else if(element.fireEvent)
+ else if(document.createEventObject)
{
- element.fireEvent('on'+type);
- if(element[type])
- element[type]();
+ var evObj = document.createEventObject();
+ element.fireEvent('on'+type, evObj);
}
- else if(element[type])
- element[type]();
+ else if(typeof(element['on'+type]) == "function")
+ element['on'+type]();
}
});
\ No newline at end of file
--
cgit v1.2.3