जैसा कि @figha का कहना है, यदि यह आपका अपना वेब पेज है , तो आपको तत्व को दिखाई देने के बाद आपको बस जो भी चलाने की आवश्यकता है, उसे चलाना चाहिए।
हालांकि, इस सवाल का जवाब देने के उद्देश्य से (और कोई भी क्रोम या फ़ायरफ़ॉक्स एक्सटेंशन बनाना , जहां यह एक सामान्य उपयोग का मामला है), म्यूटेशन सारांश और म्यूटेशन ऑब्जर्वर डोम परिवर्तन को ट्रिगर करने की अनुमति देगा।
उदाहरण के लिए, data-widgetDOM में जोड़े जाने वाले विशेषता वाले तत्वों के लिए किसी घटना को ट्रिगर करना । डेविड वाल्श के ब्लॉग से इस उत्कृष्ट उदाहरण को उधार लेना :
var observer = new MutationObserver(function(mutations) {
// For the sake of...observation...let's output the mutation to console to see how this all works
mutations.forEach(function(mutation) {
console.log(mutation.type);
});
});
// Notify me of everything!
var observerConfig = {
attributes: true,
childList: true,
characterData: true
};
// Node, config
// In this case we'll listen to all changes to body and child nodes
var targetNode = document.body;
observer.observe(targetNode, observerConfig);
जवाब में शामिल हैं added, removed, valueChangedअधिक से । valueChangedसभी विशेषताओं सहित, displayआदि।