- // Pre-compile a regular expression to handle class searches
- if ( m[1] == "." )
- var rec = new RegExp("(^|\\s)" + m[2] + "(\\s|$)");
-
- // We need to find all descendant elements, it is more
- // efficient to use getAll() when we are already further down
- // the tree - we try to recognize that here
- for ( var i = 0, rl = ret.length; i < rl; i++ )
- jQuery.merge( r,
- m[1] != "" && ret.length != 1 ?
- jQuery.getAll( ret[i], [], m[1], m[2], rec ) :
- ret[i].getElementsByTagName( m[1] != "" || m[0] == "" ? "*" : m[2] )
- );
+ // We need to find all descendant elements
+ for ( var i = 0; ret[i]; i++ ) {
+ // Grab the tag name being searched for
+ var tag = m[1] != "" || m[0] == "" ? "*" : m[2];
+
+ // Handle IE7 being really dumb about <object>s
+ if ( tag == "*" && ret[i].nodeName.toLowerCase() == "object" )
+ tag = "param";
+
+ r = jQuery.merge( r, ret[i].getElementsByTagName( tag ));
+ }