You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
1.5 KiB
JavaScript
60 lines
1.5 KiB
JavaScript
define("dojo/_base/event", ["./kernel", "../on", "../has", "../dom-geometry"], function(dojo, on, has, dom){
|
|
// module:
|
|
// dojo/_base/event
|
|
|
|
if(on._fixEvent){
|
|
var fixEvent = on._fixEvent;
|
|
on._fixEvent = function(evt, se){
|
|
// add some additional normalization for back-compat, this isn't in on.js because it is somewhat more expensive
|
|
evt = fixEvent(evt, se);
|
|
if(evt){
|
|
dom.normalizeEvent(evt);
|
|
}
|
|
return evt;
|
|
};
|
|
}
|
|
|
|
var ret = {
|
|
// summary:
|
|
// This module defines dojo DOM event API. Usually you should use dojo/on, and evt.stopPropagation() +
|
|
// evt.preventDefault(), rather than this module.
|
|
|
|
fix: function(/*Event*/ evt, /*DOMNode*/ sender){
|
|
// summary:
|
|
// normalizes properties on the event object including event
|
|
// bubbling methods, keystroke normalization, and x/y positions
|
|
// evt: Event
|
|
// native event object
|
|
// sender: DOMNode
|
|
// node to treat as "currentTarget"
|
|
if(on._fixEvent){
|
|
return on._fixEvent(evt, sender);
|
|
}
|
|
return evt; // Event
|
|
},
|
|
|
|
stop: function(/*Event*/ evt){
|
|
// summary:
|
|
// prevents propagation and clobbers the default action of the
|
|
// passed event
|
|
// evt: Event
|
|
// The event object. If omitted, window.event is used on IE.
|
|
if(has("dom-addeventlistener") || (evt && evt.preventDefault)){
|
|
evt.preventDefault();
|
|
evt.stopPropagation();
|
|
}else{
|
|
evt = evt || window.event;
|
|
evt.cancelBubble = true;
|
|
on._preventDefault.call(evt);
|
|
}
|
|
}
|
|
};
|
|
|
|
if( 1 ){
|
|
dojo.fixEvent = ret.fix;
|
|
dojo.stopEvent = ret.stop;
|
|
}
|
|
|
|
return ret;
|
|
});
|