Sha256: 7d2a45f4fb091c810479e10b8c0657190287ddd64f859714b98aeafca1147795

Contents?: true

Size: 1.23 KB

Versions: 8

Compression:

Stored size: 1.23 KB

Contents

<script>

  function initializeMutationObserver(){
    window.mutationObserver = new MutationObserver(function(mutations) {
      console.log("Mutation observed")
      if (!window.target) {
        console.log("There is no window.target element. Quitting the mutation callback function");
        return;
      }
      var options = "";
      var targetClass = window.target.classList[0] ? `.${window.target.classList[0]}` : ""
      var text = window.target.innerText ? `', text: '${window.target.innerText}` : ""
      var action = `${finderForElement(window.target)}.hover`;
      // var action = `find('${window.target.localName}${targetClass}${text}').hover`;
      var target = "";
      var testingOutput = JSON.parse(sessionStorage.getItem("testingOutput"));
      testingOutput.push({action: action, target: target, options: options});
      sessionStorage.setItem("testingOutput", JSON.stringify(testingOutput));
    });
    
    
    
  }

  function mutationStart(evt) {
    window.target = evt.target;
    const opts = {attributes: true, characterData: true, childList: true, subtree: true}
    window.mutationObserver.observe(document.documentElement, opts);
  }

  function mutationEnd () {
    window.mutationObserver.disconnect();
  }


</script>

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
magic_test-0.0.9 app/views/magic_test/_mutation_observer.html
magic_test-0.0.7 app/views/magic_test/_mutation_observer.html
magic_test-0.0.6 app/views/magic_test/_mutation_observer.html
magic_test-0.0.5 app/views/magic_test/_mutation_observer.html
magic_test-0.0.4 app/views/magic_test/_mutation_observer.html
magic_test-0.0.3 app/views/magic_test/_mutation_observer.html
magic_test-0.0.2 app/views/magic_test/_mutation_observer.html
magic_test-0.0.1 app/views/magic_test/_mutation_observer.html