Element has no method hasAttribute, Why?
<p>I'm trying to iterate "up" through the DOM nodes from a given element to get the first parent element which has the attribute 'animated'.</p>

<pre><code>var el = evt.target;
    console.log(el);
while (!el.hasAttribute('animated'))
   { el = el.parentNode; }
return el;
    console.log(el);
</code></pre>

<p>Throws error: </p>

<p><code>&gt;&gt;&gt;Uncaught TypeError: Object #&lt;HTMLDocument&gt; has no method 'hasAttribute'</code></p>

<p>How is this possible? I've clearly declared the variable <code>el</code> and the first log is correct .</p>
