mirror of
https://github.com/jquery/jquery.git
synced 2025-01-10 18:24:24 +00:00
Simplify getAll helper
This commit is contained in:
parent
fa3dad300f
commit
25712d77c3
@ -613,19 +613,9 @@ function cloneCopyEvent( src, dest ) {
|
||||
}
|
||||
|
||||
function getAll( context, tag ) {
|
||||
var elems, elem,
|
||||
i = 0,
|
||||
ret = typeof context.getElementsByTagName !== "undefined" ? context.getElementsByTagName( tag || "*" ) :
|
||||
typeof context.querySelectorAll !== "undefined" ? context.querySelectorAll( tag || "*" ) :
|
||||
undefined;
|
||||
|
||||
if ( !ret ) {
|
||||
for ( ret = [], elems = context.childNodes || context; (elem = elems[ i ]) != null; i++ ) {
|
||||
core_push.apply( ret, !tag || jQuery.nodeName( elem, tag ) ?
|
||||
getAll( elem, tag ) :
|
||||
elems );
|
||||
}
|
||||
}
|
||||
var ret = context.getElementsByTagName ? context.getElementsByTagName( tag || "*" ) :
|
||||
context.querySelectorAll ? context.querySelectorAll( tag || "*" ) :
|
||||
[];
|
||||
|
||||
return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
|
||||
jQuery.merge( [ context ], ret ) :
|
||||
|
Loading…
Reference in New Issue
Block a user