andreikondratev commented on a change in pull request #382: WICKET-6688 add RFC 
and replace eval with DOM eval
URL: https://github.com/apache/wicket/pull/382#discussion_r326939105
 
 

 ##########
 File path: 
wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
 ##########
 @@ -956,7 +975,7 @@
 
                                        try {
                                                // do the evaluation in global 
scope
-                                               var f = window.eval(toExecute);
+                                               var f = 
jQuery.globalEval(toExecute, {nonce: nonce});
 
 Review comment:
   This kind of a black magic. 
   
   Why can't this be done with something like this
   ```
   function myHideFunction(id) {
     var el = $("#"+id);
     el.attr("id", id+"-anim").fadeOut(500);
     $("<span/>").attr("id", id).appendTo(el.parent());
   }
   
   function myShowFunction(id) {
     setTimeout(function() {
       var el = $("#"+id);
       el.fadeIn(500);
     }, 500);
   }
   ```
   
   or maybe
   ```
   function mySubscriber(evt, id) {
     $("#"+id).fadeIn(500);
     Wicket.Event.unsubscribe("/myAnim/hidden/"+id, mySubscriber);
   }
   
   function myHideFunction(id) {
     var el = $("#"+id);
     el.attr("id", id+"-anim").fadeOut(500, function(){
       Wicket.Event.publish("/myAnim/hidden/"+id, id);
     });
     $("<span/>").attr("id", id).appendTo(el.parent());
   }
   
   function myShowFunction(id) {
     Wicket.Event.subscribe("/myAnim/hidden/"+id, mySubscriber);
   }
   ```
   ?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to