Chrome extension that runs code when ajax requests happen

前端 未结 2 544
暖寄归人
暖寄归人 2020-12-15 09:25

So, to give a basic description of my issue.

I have a extension that is working right now (finally) that wraps phonenumbers in an type of tag.

It is workin

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-15 10:10

    This is an updated answer using MutationObserver, since MutationSummary is not working anymore:

    var observer = new MutationObserver(function(mutationsList) {
      console.log(`Something has changed`);
    });
    
    observer.observe(document.querySelector('.whatever'), {
      attributes: true,
      characterData: true,
      childList: true,
      subtree: true
    });
    
    • Make sure to change the .whatever selector to whichever class/id you are interested in.
    • Make sure to specify true/false in the subtree option in case you are interested in children modifications of the selector or not.

提交回复
热议问题