summaryrefslogtreecommitdiff
path: root/framework/Web/Javascripts/extended
diff options
context:
space:
mode:
authorwei <>2006-01-21 02:07:59 +0000
committerwei <>2006-01-21 02:07:59 +0000
commit407aa2ff5d56859fcd1f47b85b4c4180d035c428 (patch)
tree7c4442ad2652f3021a969391fd8a468ca9400100 /framework/Web/Javascripts/extended
parentf74267f8927d39b5cb3dc43203060488371127c9 (diff)
Fixed DefaultButton and TLinkButton
Diffstat (limited to 'framework/Web/Javascripts/extended')
-rw-r--r--framework/Web/Javascripts/extended/base.js2
-rw-r--r--framework/Web/Javascripts/extended/event.js33
2 files changed, 31 insertions, 4 deletions
diff --git a/framework/Web/Javascripts/extended/base.js b/framework/Web/Javascripts/extended/base.js
index e3ca729b..48927b75 100644
--- a/framework/Web/Javascripts/extended/base.js
+++ b/framework/Web/Javascripts/extended/base.js
@@ -29,6 +29,6 @@ function $(n,d) {
Function.prototype.bindEvent = function() {
var __method = this, args = $A(arguments), object = args.shift();
return function(event) {
- return __method.call(object, event || window.event, args);
+ return __method.apply(object, [event || window.event].concat(args));
}
}
diff --git a/framework/Web/Javascripts/extended/event.js b/framework/Web/Javascripts/extended/event.js
index a7514cda..b6dccf3b 100644
--- a/framework/Web/Javascripts/extended/event.js
+++ b/framework/Web/Javascripts/extended/event.js
@@ -26,12 +26,39 @@ Object.extend(Event, {
return e.keyCode != null ? e.keyCode : e.charCode
},
+ isHTMLEvent : function(type)
+ {
+ var events = ['abort', 'blur', 'change', 'error', 'focus', 'load', 'reset', 'resize', 'scroll', 'select', 'submit', 'unload'];
+ return events.include(type);
+ },
+
+ isMouseEvent : function(type)
+ {
+ var events = ['click', 'mousedown', 'mousemove', 'mouseout', 'mouseover', 'mouseup'];
+ return events.include(type);
+ },
+
fireEvent : function(element,type)
{
if(document.createEvent)
- {
- var event = document.createEvent('HTMLEvents');
- event.initEvent(type, true, true);
+ {
+ if(Event.isHTMLEvent(type))
+ {
+ var event = document.createEvent('HTMLEvents');
+ event.initEvent(type, true, true);
+ }
+ else if(Event.isMouseEvent(type))
+ {
+ var event = document.createEvent('MouseEvents');
+ event.initMouseEvent(type,true,true,
+ document.defaultView, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
+ }
+ else
+ {
+ if(Logger)
+ Logger.error("undefined event", type);
+ return;
+ }
element.dispatchEvent(event);
}
else if(element.fireEvent)