开发者

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

开发者 https://www.devze.com 2023-03-13 09:21 出处:网络
When using closure compiler with ADVANCED_OPTIMIZATIONS, jQuery.ajax.data object is changed: $.ajax({ type: \"POST\",

When using closure compiler with ADVANCED_OPTIMIZATIONS, jQuery.ajax.data object is changed:

$.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, like 'act' : "some", but I want this to work without quotes. In my externs file there is:

/** @type {Object.<string,*>} */ jQuery.ajax.data; But this doesn't work. Closure compiler version 1043


Try the externs with something like :

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

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

0

精彩评论

暂无评论...
验证码 换一张
取 消