Dom.oneobject = function (arr,val) {
var result = {},value = val!== undefined? Val:1;
for (Var i=0,n=arr.length;i<n;i++)
Result[arr[i]] = value;
return result;
};
Dom.mixin = function (result, source) {
if (arguments.length = = 1) {
Source = result;
result = DOM;
}
If (result && source) {
for (var key in Source)
Source.hasownproperty (Key) && (Result[key] = Source[key]);
}
if (Arguments.length > 2) {
var others = [].slice.call (arguments,2);
for (Var i=0,n=others.length;i<n;i++) {
result = Arguments.callee (Result,others[i]);
}
}
return result;
}
var mouseeventone = Dom.oneobject (["Click", "DblClick", "MouseDown",
"MouseMove", "mouseout", "MouseOver", "MouseUp"], "[Object MouseEvent]");
var htmleventone = Dom.oneobject (["Abort", "blur", "Change", "error", "Focus",
"Load", "reset", "resize", "scroll", "select", "Submit", "unload"], "[Object Event]");
var keyboardeventone = Dom.oneobject (["KeyUp", "KeyDown", "KeyPress",],
"[Object KeyboardEvent]");
var EventMap = dom.mixin ({},mouseeventone,htmleventone,keyboardeventone)
var fn = "Prototype";
Dom. Event = function (src) {
if (!this.preventdefault) {
Return to new DOM. Event[fn].init (SRC);
}
};
function Returnfalse () {
return false;
}
function Returntrue () {
return true;
}
Http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
Dom. EVENT[FN] = {
Init:function (SRC) {
If the event object is passed in
if (src && src.type) {
This.originalevent = src;
This.type = Src.type;
If the event type is passed in
} else {
This.type = src;
}
This.timestamp = new Date (). valueof ();
this["expando"] = true;
},
Http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/events.html#Conformance
Tostring:function () {
return Eventmap[this.type] | | "[Object Event]"
},
Preventdefault:function () {
this.isdefaultprevented = Returntrue;
var e = this.originalevent;
if (!e) {
Return
}
If there is a preventdefault then call it
if (E.preventdefault) {
E.preventdefault ();
}
If there is a returnvalue then set it to False
E.returnvalue = false;
},
Stoppropagation:function () {
this.ispropagationstopped = Returntrue;
var e = this.originalevent;
if (!e) {
Return
}
If there is a preventdefault then call it
if (e.stoppropagation) {
E.stoppropagation ();
}
If there is a returnvalue then set it to True
E.cancelbubble = true;
},
Stopimmediatepropagation:function () {
this.isimmediatepropagationstopped = Returntrue;
This.stoppropagation ();
},
Isdefaultprevented:returnfalse,
Ispropagationstopped:returnfalse,
Isimmediatepropagationstopped:returnfalse
};
Dom. EVENT[FN].INIT[FN] = dom. EVENT[FN];