Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. // выбираем элемент
  2. const target = document.querySelector('#some-id');
  3.  
  4. // создаем экземпляр обсервера
  5. const observer = new MutationObserver((mutations) => {
  6. mutations.forEach((mutation) => console.log(mutation.type));
  7. });
  8.  
  9. // передаем элемент и настройки в обсервер
  10. observer.observe(target, { attributes: true, childList: true, characterData: true });
  11.  
  12. // отписываемся
  13. observer.disconnect();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement