anyone know why I can run this in firefox and not in IE ?

anyone know why I can run this in firefox and not in IE ?

this works perfect in firefox but It seems to get caught in loop while collecting items in IE
here is the function:
 
  1. $.fn.reverse =

    function () {

    return this.pushStack(this.get().reverse(), arguments);

    };

    // create two new functions: prevALL and nextALL.

    $.each([

    'prev', 'next'], function (unusedIndex, name) {

    $.fn[name +

    'ALL'] = function (matchExpr) {

    // get all the elements in the body, including the body.

    var $all = $('body').find('*').andSelf();

    // slice the $all object according to which way we're looking

    $all = (name ==

    'prev')

    ? $all.slice(0, $all.index(

    this)).reverse()

    : $all.slice($all.index(

    this) + 1)

    ;

    // filter the matches if specified

    if (matchExpr) $all = $all.filter(matchExpr);

    return $all;

    };

    });

  2. usage:
  3. var tblPrevId = $( this ).prevALL( 'table.grid:eq(1)' ).attr( 'id' );
  4. var tblNextId = $( this ).nextALL( 'table.grid:first' ).attr( 'id' );