How to save jQuery.ajax.data object when using closure compiler?

When using the close compiler with ADVANCED_OPTIMIZATIONS, the jQuery.ajax.data object changes:

$.ajax({
  type: "POST",
  url: "ajax.php",
  data: {
     act : "some"
  },
  success : function(data){}
});

JQuery.ajax.data object is converted to {L : "some"}

I can use quotes, for example 'act' : "some", but I want this to work without quotes. In my externs file there is:

/** @type {Object.<string,*>} */ jQuery.ajax.data; But that does not work. Closing the compiler version 1043

+3
source share
1 answer

Try externs with something like:

var jQuery = {};
jQuery.ajax = {
    data: '' 
}

This will not rename 'jQuery.ajax' and 'jQuery.ajax.data'

0
source

All Articles