Merge branch 'master' of github.com:jquery/jquery

This commit is contained in:
jaubourg 2011-04-12 00:27:51 +02:00
commit f6f1cc77f4
4 changed files with 45 additions and 14 deletions

View file

@ -304,7 +304,7 @@ jQuery.event = {
}
event.namespace = namespaces.join(".");
event.namespace_re = new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)");
// Handle a global trigger
if ( !elem ) {
// Don't bubble custom events when global (to avoid too much overhead)
@ -574,6 +574,9 @@ jQuery.Event = function( src ) {
}
}
// Always ensure a type has been explicitly set
this.type = src.type;
// Events bubbling up the document may have been marked as prevented
// by a handler lower down the tree; reflect the correct value.
this.isDefaultPrevented = (src.defaultPrevented || src.returnValue === false ||
@ -1030,10 +1033,18 @@ jQuery.each(["live", "die"], function( i, name ) {
return this;
}
if ( name === "die" && !types &&
origSelector && origSelector[0] === "." ) {
context.unbind( origSelector );
return this;
}
if ( data === false || jQuery.isFunction( data ) ) {
fn = data || returnFalse;
data = undefined;
}
}
types = (types || "").split(" ");

View file

@ -73,9 +73,9 @@ jQuery.fn.extend({
},
is: function( selector ) {
return !!selector && (typeof selector === "string" ?
return !!selector && ( typeof selector === "string" ?
jQuery.filter( selector, this ).length > 0 :
this.filter( selector ).length > 0);
this.filter( selector ).length > 0 );
},
closest: function( selectors, context ) {
@ -298,13 +298,18 @@ jQuery.extend({
// Implement the identical functionality for filter and not
function winnow( elements, qualifier, keep ) {
// Can't pass null or undefined to indexOf in Firefox 4
// Set to 0 to skip string check
qualifier = qualifier || 0;
if ( jQuery.isFunction( qualifier ) ) {
return jQuery.grep(elements, function( elem, i ) {
var retVal = !!qualifier.call( elem, i, elem );
return retVal === keep;
});
} else if ( qualifier && qualifier.nodeType ) {
} else if ( qualifier.nodeType ) {
return jQuery.grep(elements, function( elem, i ) {
return (elem === qualifier) === keep;
});