[英]How can I detect AJAX node insertion without using DOM mutation events?
如果你想檢測AJAX創建的節點你的選擇(除了你明智要排除的Mutation事件)是:
我已經一次完成了所有這些,除了一個以外都有一個主要的缺點:
我建議你使用waitForKeyElements()實用程序並完成它。 它非常易於使用。 例如:
// ==UserScript==
// @name Highlight good comments
// @include http://SOME_SITE/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// ==/UserScript==
function highlightGoodComments (jNode) {
if (/beer/i.test (jNode.text () ) ) {
jNode.css ("background", "yellow");
}
}
waitForKeyElements ("#userBlather div.comment", highlightGoodComments);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.