Added a fix for the context of events.
This commit is contained in:
parent
8192bd8e91
commit
3d334ad806
23
jquery/jquery.js
vendored
23
jquery/jquery.js
vendored
|
@ -19,8 +19,8 @@ window.undefined = window.undefined;
|
||||||
function jQuery(a,c) {
|
function jQuery(a,c) {
|
||||||
|
|
||||||
// Shortcut for document ready (because $(document).each() is silly)
|
// Shortcut for document ready (because $(document).each() is silly)
|
||||||
if ( a && a.constructor == Function )
|
if ( a && a.constructor == Function && jQuery.fn.ready )
|
||||||
return $(document).ready(a);
|
return jQuery(document).ready(a);
|
||||||
|
|
||||||
// Make sure t hat a selection was provided
|
// Make sure t hat a selection was provided
|
||||||
a = a || jQuery.context || document;
|
a = a || jQuery.context || document;
|
||||||
|
@ -49,7 +49,7 @@ function jQuery(a,c) {
|
||||||
|
|
||||||
// Watch for when a jQuery object is passed at the context
|
// Watch for when a jQuery object is passed at the context
|
||||||
if ( c && c.jquery )
|
if ( c && c.jquery )
|
||||||
return $(c.get()).find(a);
|
return jQuery(c.get()).find(a);
|
||||||
|
|
||||||
// If the context is global, return a new object
|
// If the context is global, return a new object
|
||||||
if ( window == this )
|
if ( window == this )
|
||||||
|
@ -187,12 +187,12 @@ jQuery.fn = jQuery.prototype = {
|
||||||
* @type jQuery
|
* @type jQuery
|
||||||
* @param Function fn A function to execute
|
* @param Function fn A function to execute
|
||||||
*/
|
*/
|
||||||
each: function( fn ) {
|
each: function( fn, args ) {
|
||||||
// Iterate through all of the matched elements
|
// Iterate through all of the matched elements
|
||||||
for ( var i = 0; i < this.length; i++ )
|
for ( var i = 0; i < this.length; i++ )
|
||||||
|
|
||||||
// Execute the function within the context of each element
|
// Execute the function within the context of each element
|
||||||
fn.apply( this[i], [i] );
|
fn.apply( this[i], args || [i] );
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
@ -936,12 +936,9 @@ new function() {
|
||||||
for ( var i in each ) new function() {
|
for ( var i in each ) new function() {
|
||||||
var n = each[i];
|
var n = each[i];
|
||||||
jQuery.fn[ i ] = function() {
|
jQuery.fn[ i ] = function() {
|
||||||
var args = arguments;
|
return this.each( n, arguments );
|
||||||
return this.each(function(){
|
|
||||||
n.apply( this, args );
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
var attr = {
|
var attr = {
|
||||||
val: "value",
|
val: "value",
|
||||||
|
@ -1578,8 +1575,10 @@ jQuery.extend({
|
||||||
|
|
||||||
var returnValue = true;
|
var returnValue = true;
|
||||||
|
|
||||||
for ( var j in this.events[event.type] ) {
|
var c = this.events[event.type];
|
||||||
if (this.events[event.type][j](event) === false) {
|
|
||||||
|
for ( var j in c ) {
|
||||||
|
if ( c[j].apply( this, [event] ) === false ) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
returnValue = false;
|
returnValue = false;
|
||||||
|
|
Loading…
Reference in a new issue