diff options
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 |