aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg <markelog@gmail.com>2012-12-24 04:29:41 +0400
committerOleg <markelog@gmail.com>2012-12-24 04:29:41 +0400
commit25712d77c3bc0221b5b2b9b9492c20a9cfbe1b17 (patch)
tree241098bacabff1619f2b49648317c823d4706ce7
parentfa3dad300fb6dc1882eef178cc22a1d7f3974ec1 (diff)
downloadjquery-25712d77c3bc0221b5b2b9b9492c20a9cfbe1b17.tar.gz
jquery-25712d77c3bc0221b5b2b9b9492c20a9cfbe1b17.zip
Simplify getAll helper
-rw-r--r--src/manipulation.js16
1 files changed, 3 insertions, 13 deletions
diff --git a/src/manipulation.js b/src/manipulation.js
index 61a6216be..b211fe16f 100644
--- a/src/manipulation.js
+++ b/src/manipulation.js
@@ -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 ) :