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:
- var empty = ($(":not(script)", destination).length == 0);
destination resolves to a selector "#TabContent", which is a div. The context is the following Javascript function:
- PRISMbase.LoadPartialEx = function(url, data, destination, successCallback, loadingMessage, appendNotOverwrite) {
- var empty = ($(":not(script)", destination).length == 0);
- var message = loadingMessage == null ? "Please wait" : loadingMessage;
- if (empty)
- destination.html(busy);
- else
- destination.block({ message: '<h1 class="Progress">' + message + '</h1>' });
- return $.ajax({
- data: data,
- dataType: "html", type: "GET", url: url,
- success: function(viewHtml) {
- var partial = $(viewHtml);
- if (!empty)
- destination.unblock();
- if(viewHtml != "")
- {
- if (appendNotOverwrite)
- destination.append(partial);
- else
- destination.html(partial);
-
- PRISMbase.InitialiseFormElements(destination);
- }
- else
- destination.empty();
- if (successCallback != null) successCallback(destination, partial);
- }
- });
- }
busy in the above code is a variable:
- var busy = '<img class="progress" src="/Content/ProgressCircle.gif" />';
Thanks in advance for your help.
Alan