我this jsfiddlefn.toggle(handler(eventObject),handler(eventObject)...)哪裏有?
它採用 - 不要與toggle被confued - jQuery的版本設置爲EDGE
它突然停止工作並刪除我想作爲觸發細胞,因爲它明顯地恢復到toggle。
我找不到任何貶低的標籤或如
http://api.jquery.com/category/deprecated/給出了404
如果我添加了Migrate模塊我jsFiddle then works,我看到控制檯(由https://github.com/jquery/jquery-migrate/blob/master/warnings.md闡述張貼由弗雷德裏克·哈米迪)警告
我看到Deprecate fn toggle和issue 24和Ticket #11786但我不希望看到它。
我在想什麼,在哪裏可以找到替代品和文檔?
注:據我瞭解棄用的原因,我只是找不到的折舊
$('#tbl .xx').toggle(
function() {
$(this).siblings().each(function(){
var t = $(this).text();
$(this).html($('<input />',{'value' : t}));
});
},
function() {
$(this).siblings().each(function(){
var inp = $(this).find('input');
if (inp.length){
$(this).text(inp.val());
}
});
}
);
守則MIGRATE官方文檔:
jQuery.fn.toggle = function(fn, fn2) {
// Don't mess with animation or css toggles
if (!jQuery.isFunction(fn) || !jQuery.isFunction(fn2)) {
return oldToggle.apply(this, arguments);
}
migrateWarn("jQuery.fn.toggle(handler, handler...) is deprecated");
// Save reference to arguments for access in closure
var args = arguments,
guid = fn.guid || jQuery.guid++,
i = 0,
toggler = function(event) {
// Figure out which function to execute
var lastToggle = (jQuery._data(this, "lastToggle" + fn.guid) || 0) % i;
jQuery._data(this, "lastToggle" + fn.guid, lastToggle + 1);
// Make sure that clicks stop
event.preventDefault();
// and execute the function
return args[ lastToggle ].apply(this, arguments) || false;
};
// link all the functions, so any of them can unbind this click handler
toggler.guid = guid;
while (i < args.length) {
args[ i++ ].guid = guid;
}
return this.click(toggler);
};
UPDATE我曾問如果他們可以保持代碼爲fn.toggler所以它是一個重命名而不是刪除
根據[bugs.jquery.com]中的[ticket#11786](http://bugs.jquery.com/ticket/11786)(http:// bugs .jquery.com),似乎[toggle event](http://api.jquery.com/toggle-event/)已被棄用/棄用;但你說得對,我無法在[toggle event](http://api.jquery.com/toggle-event/)的頁面中看到。我建議你在票上添加評論。 – Pang
完成,謝謝... – mplungjan
我記得有一段時間聽到這個消息,並且感到困惑,它似乎沒有在前端文檔中標記爲已棄用。 –