Updated Branches:
  refs/heads/master 825da3055 -> 2c2df2efe

Small optimization - do not read the <component>'s text if the old HTML element 
is not in the DOM


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

Branch: refs/heads/master
Commit: ce837c4b26f905a17f4b75bf7973a65c017c74ef
Parents: 825da30
Author: Martin Tzvetanov Grigorov <[email protected]>
Authored: Fri Feb 7 09:20:44 2014 +0100
Committer: Martin Tzvetanov Grigorov <[email protected]>
Committed: Fri Feb 7 09:20:44 2014 +0100

----------------------------------------------------------------------
 .../wicket/ajax/res/js/wicket-ajax-jquery.js     | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/ce837c4b/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 225b6f1..0d35929 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
@@ -1027,16 +1027,6 @@
                        context.steps.push(function (notify) {
                                // get the component id
                                var compId = node.getAttribute("id");
-                               var text = jQuery(node).text();
-
-                               // if the text was escaped, unascape it
-                               // (escaping is done when the component body 
contains a CDATA section)
-                               var encoding = node.getAttribute("encoding");
-                               if (encoding) {
-                                       text = 
Wicket.Head.Contributor.decode(encoding, text);
-                               }
-
-                               // get existing component
                                var element = Wicket.$(compId);
 
                                if (isUndef(element)) {
@@ -1044,6 +1034,15 @@
                                                compId + "]] was not found 
while trying to perform markup update. " +
                                                "Make sure you called 
component.setOutputMarkupId(true) on the component whose markup you are trying 
to update.");
                                } else {
+                                       var text = jQuery(node).text();
+
+                                       // if the text was escaped, unescape it
+                                       // (escaping is done when the component 
body contains a CDATA section)
+                                       var encoding = 
node.getAttribute("encoding");
+                                       if (encoding) {
+                                               text = 
Wicket.Head.Contributor.decode(encoding, text);
+                                       }
+
                                        // replace the component
                                        Wicket.DOM.replace(element, text);
                                }

Reply via email to