git.asbjorn.biz
/
jquery.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added fix for jQuery.extend( Object, null || undefined ) lapsing back to just jQuery...
[jquery.git]
/
src
/
event
/
event.js
diff --git
a/src/event/event.js
b/src/event/event.js
index
3610122
..
a60c461
100644
(file)
--- a/
src/event/event.js
+++ b/
src/event/event.js
@@
-80,7
+80,7
@@
jQuery.fn.extend({
var p = (e.type == "mouseover" ? e.fromElement : e.toElement) || e.relatedTarget;
// Traverse up the tree
var p = (e.type == "mouseover" ? e.fromElement : e.toElement) || e.relatedTarget;
// Traverse up the tree
- while ( p && p != this ) p = p.parentNode;
+ while ( p && p != this ) try { p = p.parentNode } catch(e) { p = this; };
// If we actually just moused on to a sub-element, ignore it
if ( p == this ) return false;
// If we actually just moused on to a sub-element, ignore it
if ( p == this ) return false;
@@
-107,6
+107,8
@@
jQuery.fn.extend({
* Please ensure you have no code in your <body> onload event handler,
* otherwise $(document).ready() may not fire.
*
* Please ensure you have no code in your <body> onload event handler,
* otherwise $(document).ready() may not fire.
*
+ * You can have as many $(document).ready events on your page as you like.
+ *
* @example $(document).ready(function(){ Your code here... });
*
* @name ready
* @example $(document).ready(function(){ Your code here... });
*
* @name ready
@@
-153,6
+155,9
@@
jQuery.extend({
// Reset the list of functions
jQuery.readyList = null;
}
// Reset the list of functions
jQuery.readyList = null;
}
+ // Remove event lisenter to avoid memory leak
+ if ( jQuery.browser.mozilla || jQuery.browser.opera )
+ document.removeEventListener( "DOMContentLoaded", jQuery.ready, false );
}
}
});
}
}
});
@@
-720,11
+725,15
@@
new function(){
* Trigger the load event of each matched element. This causes all of the functions
* that have been bound to thet load event to be executed.
*
* Trigger the load event of each matched element. This causes all of the functions
* that have been bound to thet load event to be executed.
*
+ * Marked as private: Calling load() without arguments throws exception because the ajax load
+ * does not handle it.
+ *
* @example $("p").load();
* @before <p onload="alert('Hello');">Hello</p>
* @result alert('Hello');
*
* @name load
* @example $("p").load();
* @before <p onload="alert('Hello');">Hello</p>
* @result alert('Hello');
*
* @name load
+ * @private
* @type jQuery
* @cat Events/Browser
*/
* @type jQuery
* @cat Events/Browser
*/
@@
-1591,7
+1600,7
@@
new function(){
// Add the event
jQuery.event.add( this, o, function(e){
// If this function has already been executed, stop
// Add the event
jQuery.event.add( this, o, function(e){
// If this function has already been executed, stop
- if ( count++ ) return;
+ if ( count++ ) return true;
// And execute the bound function
return f.apply(this, [e]);
// And execute the bound function
return f.apply(this, [e]);
@@
-1649,10
+1658,10
@@
new function(){
};
// Clean up after IE to avoid memory leaks
};
// Clean up after IE to avoid memory leaks
-if ($.browser.msie) $(window).unload(function() {
+if (jQuery.browser.msie) jQuery(window).unload(function() {
var event = jQuery.event, global = event.global;
for (var type in global) {
var els = global[type], i = els.length;
var event = jQuery.event, global = event.global;
for (var type in global) {
var els = global[type], i = els.length;
- if (i>0) do event.remove(els[i-1], type); while (--i);
+ if (i>0) do if (type != 'unload') event.remove(els[i-1], type); while (--i);
}
});
}
});