git.asbjorn.biz
/
jquery.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
jquery event: closes #4033. e.currentTarget wasn't being enforced for native events...
[jquery.git]
/
src
/
event.js
diff --git
a/src/event.js
b/src/event.js
index
405e19f
..
a50fe89
100644
(file)
--- a/
src/event.js
+++ b/
src/event.js
@@
-240,7
+240,8
@@
jQuery.event = {
var all, handlers;
event = arguments[0] = jQuery.event.fix( event || window.event );
var all, handlers;
event = arguments[0] = jQuery.event.fix( event || window.event );
-
+ event.currentTarget = this;
+
// Namespaced event handlers
var namespaces = event.type.split(".");
event.type = namespaces.shift();
// Namespaced event handlers
var namespaces = event.type.split(".");
event.type = namespaces.shift();
@@
-377,13
+378,13
@@
jQuery.Event = function( src ){
if( src && src.type ){
this.originalEvent = src;
this.type = src.type;
if( src && src.type ){
this.originalEvent = src;
this.type = src.type;
- this.timeStamp = src.timeStamp;
// Event type
}else
this.type = src;
// Event type
}else
this.type = src;
- if( !this.timeStamp )
- this.timeStamp = now();
+ // timeStamp is buggy for some events on Firefox(#3843)
+ // So we won't rely on the native value
+ this.timeStamp = now();
// Mark it as fixed
this[expando] = true;
// Mark it as fixed
this[expando] = true;
@@
-545,7
+546,7
@@
jQuery.fn.extend({
live: function( type, fn ){
var proxy = jQuery.event.proxy( fn );
live: function( type, fn ){
var proxy = jQuery.event.proxy( fn );
- proxy.guid += this.selector;
+ proxy.guid += this.selector + type;
jQuery(document).bind( liveConvert(type, this.selector), this.selector, proxy );
jQuery(document).bind( liveConvert(type, this.selector), this.selector, proxy );
@@
-553,22
+554,33
@@
jQuery.fn.extend({
},
die: function( type, fn ){
},
die: function( type, fn ){
- jQuery(document).unbind( liveConvert(type, this.selector), fn ? { guid: fn.guid + this.selector } : null );
+ jQuery(document).unbind( liveConvert(type, this.selector), fn ? { guid: fn.guid + this.selector + type } : null );
return this;
}
});
function liveHandler( event ){
var check = RegExp("(^|\\.)" + event.type + "(\\.|$)"),
return this;
}
});
function liveHandler( event ){
var check = RegExp("(^|\\.)" + event.type + "(\\.|$)"),
- stop = true;
+ stop = true,
+ elems = [];
jQuery.each(jQuery.data(this, "events").live || [], function(i, fn){
jQuery.each(jQuery.data(this, "events").live || [], function(i, fn){
- if ( !event.isImmediatePropagationStopped() && check.test(fn.type) ) {
+ if ( check.test(fn.type) ) {
var elem = jQuery(event.target).closest(fn.data)[0];
var elem = jQuery(event.target).closest(fn.data)[0];
- if ( elem && fn.call(elem, event, fn.data) === false )
- stop = false;
+ if ( elem )
+ elems.push({ elem: elem, fn: fn });
}
});
}
});
+
+ elems.sort(function(a,b) {
+ return jQuery.data(a.elem, "closest") - jQuery.data(b.elem, "closest");
+ });
+
+ jQuery.each(elems, function(){
+ if ( this.fn.call(this.elem, event, this.fn.data) === false )
+ return (stop = false);
+ });
+
return stop;
}
return stop;
}
@@
-630,7
+642,7
@@
function bindReady(){
// If IE and not an iframe
// continually check to see if the document is ready
// If IE and not an iframe
// continually check to see if the document is ready
- if ( document.documentElement.doScroll && !window.frameElement ) (function(){
+ if ( document.documentElement.doScroll && window == window.top ) (function(){
if ( jQuery.isReady ) return;
try {
if ( jQuery.isReady ) return;
try {