Why does waitForKeyElements() only trigger once despite later changes?
<p>For several years I've used the <a href="https://gist.github.com/BrockA/2625891" rel="nofollow"><code>waitForKeyElements()</code></a> function to track changes in webpages from a userscript. However, sometimes I've found it doesn't trigger as expected and have worked around out. I've run into another example of this problem, and so am now trying to figure out what the problem is. The following is the barest example I can create.</p>

<p>Given a simple HTML page that looks like this:</p>

<pre><code>&lt;span class="e1"&gt;blah&lt;/span&gt;
</code></pre>

<p>And some Javascript:</p>

<pre><code>// function defined here https://gist.github.com/BrockA/2625891
waitForKeyElements('.e1', handle_e1, false);

function handle_e1(node) {
    console.log(node.text());
    alert(node.text());
}

setInterval(function() {
    $('.e1').text("updated: "+Math.random());
}, 5000);
</code></pre>

<p>I would expect this code to trigger an <code>alert()</code> and a <code>console.log()</code> every 5 seconds. However, it only triggers once. Any ideas?</p>

<p>Here's <a href="http://codepen.io/bengrosser/pen/MygjrW?editors=1010" rel="nofollow">a codepen that demonstrates this</a>.  </p>