diff options
author | wei <> | 2006-05-05 04:17:03 +0000 |
---|---|---|
committer | wei <> | 2006-05-05 04:17:03 +0000 |
commit | e3320195d60c63d84480d7839c0cde8f683bd7b7 (patch) | |
tree | 6c724cbdafb93fd41cbce417d2eb811f480a61f7 /framework/Web/Javascripts/extended/event.js | |
parent | beeb00efbeb2ea5925285c68e4f9a9f680b0ffdc (diff) |
Update the Event.fireEvent(element,type) javascript function. Hope that is works in Safari.
Diffstat (limited to 'framework/Web/Javascripts/extended/event.js')
-rw-r--r-- | framework/Web/Javascripts/extended/event.js | 17 |
1 files changed, 9 insertions, 8 deletions
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 <tt>type</tt> on a DOM
* <tt>element</tt>. 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 |