Fixed evaluation of HTML through jQuery
authorAlexander Ebert <ebert@woltlab.com>
Thu, 25 Apr 2013 13:31:02 +0000 (15:31 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Thu, 25 Apr 2013 13:31:02 +0000 (15:31 +0200)
You should alway return HTML using the array index "template" (accessible as data.returnValues.template), as it's contents will be automatically trimmed.

If you fail to use it, make sure to either trim it server-side or use $($.parseHTML(htmlString)).

See http://jquery.com/upgrade-guide/1.9/#jquery-htmlstring-versus-jquery-selectorstring

wcfsetup/install/files/js/WCF.js

index d50ea005336753ef01681ece600eaa1f5c64096f..6c08977146d76ad585bb1b11bfb828d53c448c85 100755 (executable)
@@ -1629,6 +1629,11 @@ WCF.Action.Proxy = Class.extend({
                
                // call child method if applicable
                if ($.isFunction(this.options.success)) {
+                       // trim HTML before processing, see http://jquery.com/upgrade-guide/1.9/#jquery-htmlstring-versus-jquery-selectorstring
+                       if (data.returnValues && data.returnValues.template !== undefined) {
+                               data.returnValues.template = $.trim(data.returnValues.template);
+                       }
+                       
                        this.options.success(data, textStatus, jqXHR);
                }