开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜