मुझे लगता है कि यह समाधान DOM MutationObserver क्लास का उपयोग करने के लिए है। डॉक्स के रूप में बाहर बिंदु:
यह उत्परिवर्तन घटनाक्रम DOM3 घटनाक्रम विनिर्देश में परिभाषित के लिए एक स्थानापन्न के रूप में बनाया गया है। Api Docs
साइट पर उदाहरण सुंदर आत्म व्याख्यात्मक
// select the target node
var target = document.querySelector('#some-id');
// create an observer instance
var observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
console.log(mutation.type);
});
});
// configuration of the observer:
var config = { attributes: true, childList: true, characterData: true };
// pass in the target node, as well as the observer options
observer.observe(target, config);
// later, you can stop observing
observer.disconnect();
स्रोत
2015-03-08 13:10:27
यह डोम उत्परिवर्तन घटनाओं, जिसका बहिष्कार कर रहे हैं और व्यापक रूप से समर्थित कभी नहीं थे करने के समान होगा है। मुझे लगता है कि आपको ब्राउज़र की प्रोफाइलिंग सुविधाओं का उपयोग करना चाहिए। – Barmar
क्रोम देव उपकरण पर एक नज़र डालें: http://addyosmani.com/blog/performance-optimisation-with-timeline-profiles/ – superUntitled
लेकिन क्या कोड के अंदर ऐसा करने का कोई तरीका है? – Tohveli