Traversing: Don't expose jQuery.dir & jQuery.sibling

jQuery.dir & jQuery.sibling are undocumented internal APIs; they shouldn't
be exposed.

(cherry-picked from f9ef427d35)

Fixes gh-2512
Closes gh-2525
This commit is contained in:
Michał Gołębiowski
2015-08-03 19:45:26 +02:00
parent d8b7e7b0bd
commit 8c851bfdb9
3 changed files with 46 additions and 38 deletions

20
src/traversing/var/dir.js Normal file
View File

@@ -0,0 +1,20 @@
define( [
"../../core"
], function( jQuery ) {
return function( elem, dir, until ) {
var matched = [],
truncate = until !== undefined;
while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
if ( elem.nodeType === 1 ) {
if ( truncate && jQuery( elem ).is( until ) ) {
break;
}
matched.push( elem );
}
}
return matched;
};
} );

View File

@@ -0,0 +1,15 @@
define( function() {
return function( n, elem ) {
var matched = [];
for ( ; n; n = n.nextSibling ) {
if ( n.nodeType === 1 && n !== elem ) {
matched.push( n );
}
}
return matched;
};
} );