Make sure that disconnected nodes aren't sorted/uniqued. Fixes #5791.
This commit is contained in:
parent
8e53f7b5d6
commit
5d49335eac
2 changed files with 18 additions and 7 deletions
|
@ -146,9 +146,9 @@ jQuery.fn.extend({
|
|||
jQuery.makeArray( selector ),
|
||||
all = jQuery.merge( this.get(), set );
|
||||
|
||||
return this.pushStack( set[0] && (set[0].setInterval || set[0].nodeType === 9 || (set[0].parentNode && set[0].parentNode.nodeType !== 11)) ?
|
||||
jQuery.unique( all ) :
|
||||
all );
|
||||
return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ?
|
||||
all :
|
||||
jQuery.unique( all ) );
|
||||
},
|
||||
|
||||
andSelf: function() {
|
||||
|
@ -156,6 +156,12 @@ jQuery.fn.extend({
|
|||
}
|
||||
});
|
||||
|
||||
// A painfully simple check to see if an element is disconnected
|
||||
// from a document (should be improved, where feasible).
|
||||
function isDisconnected( node ) {
|
||||
return !node || !node.parentNode || node.parentNode.nodeType === 11;
|
||||
}
|
||||
|
||||
jQuery.each({
|
||||
parent: function( elem ) {
|
||||
var parent = elem.parentNode;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue