New to jQuery trying to make sense of ($(":not(script)", destination).length == 0)

New to jQuery trying to make sense of ($(":not(script)", destination).length == 0)

Hi All

I'm new to jQuery and have taken over maintaining some code developed by an ex-colleague, who didn't believe in commenting his code. It is an asp.net MVC 2 project.

The line of code I'm trying to understand is:

  1. var empty = ($(":not(script)", destination).length == 0);

destination resolves to a selector "#TabContent", which is a div. The context is the following Javascript function:

  1. PRISMbase.LoadPartialEx = function(url, data, destination, successCallback, loadingMessage, appendNotOverwrite) {
  2.     var empty = ($(":not(script)", destination).length == 0);
  3.     var message = loadingMessage == null ? "Please wait" : loadingMessage;
  4.     if (empty)
  5.         destination.html(busy);
  6.     else
  7.         destination.block({ message: '<h1 class="Progress">' + message + '</h1>' });
  8.     return $.ajax({
  9.         data: data,
  10.         dataType: "html", type: "GET", url: url,
  11.         success: function(viewHtml) {
  12.             var partial = $(viewHtml);
  13.             if (!empty)
  14.                 destination.unblock();
  15.             if(viewHtml != "")
  16.             {
  17.                 if (appendNotOverwrite)
  18.                     destination.append(partial);
  19.                 else
  20.                     destination.html(partial);
  21.                    
  22.                 PRISMbase.InitialiseFormElements(destination);
  23.             }
  24.             else
  25.                 destination.empty();
  26.             if (successCallback != null) successCallback(destination, partial);
  27.         }
  28.     });
  29. }

busy in the above code is a variable:

  1. var busy = '<img class="progress" src="/Content/ProgressCircle.gif" />';

Thanks in advance for your help.

Alan