Improve JSDoc.
Check if logging is enabled before serializing the XML document to string


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/3801d49c
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/3801d49c
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/3801d49c

Branch: refs/heads/master
Commit: 3801d49c9c11fb1be5792d01d26841270f89eebe
Parents: 4f857d1
Author: Martin Tzvetanov Grigorov <[email protected]>
Authored: Fri Feb 3 09:29:57 2012 +0200
Committer: Martin Tzvetanov Grigorov <[email protected]>
Committed: Fri Feb 3 09:30:49 2012 +0200

----------------------------------------------------------------------
 .../wicket/ajax/res/js/wicket-ajax-jquery.js       |   17 +++++++++++---
 1 files changed, 13 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/3801d49c/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js 
b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
index 4953fa6..8b9cf3c 100644
--- 
a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
+++ 
b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
@@ -560,7 +560,14 @@
                        return attrs.ad;
                },
 
-               // Method that processes the <ajax-response>
+               /**
+                * Method that processes the <ajax-response>.
+                *
+                * @param {XmlDocument} data - the <ajax-response> XML document
+                * @param {String} textStatus - the response status as text 
(e.g. 'success', 'parsererror', etc.)
+                * @param {Object} jqXHR - the jQuery wrapper around 
XMLHttpRequest
+                * @param {Object} attrs - the Ajax request attributes
+                */
                processAjaxResponse: function (data, textStatus, jqXHR, attrs) {
 
                        if (jqXHR.readyState === 4) {
@@ -610,9 +617,11 @@
                                }
                                else {
                                        // no redirect, just regular response
-                                       var responseAsText = 
jQuery(data).text();
-                                       Wicket.Log.info("Received ajax response 
(" + responseAsText.length + " characters)");
-                                       Wicket.Log.info("\n" + responseAsText);
+                                       if (Wicket.Log.enabled()) {
+                                               var responseAsText = 
jQuery(data).text();
+                                               Wicket.Log.info("Received ajax 
response (" + responseAsText.length + " characters)");
+                                               Wicket.Log.info("\n" + 
responseAsText);
+                                       }
 
                                        // invoke the loaded callback with an 
xml document
                                        return this.loadedCallback(data, attrs);

Reply via email to