typeof jQuery.data() buggy?
<p>I'm tracking a mysterious problem in my code. This "bug" happens within an <code>event handler</code> that was bound via jQuery's <code>.delegate()</code>:</p>

<pre><code>my.$table_body.delegate('.wf-dropdown', 'change', function(e){
    parent_row_element = $(e.target).closest('tr')[0];

    if( typeof $.data(parent_row_element, 'changed') == 'undefined' )
        $.data(parent_row_element, 'changed', {});

    $.data(parent_row_element, 'changed').wf_id = e.target.value;
    // .. more code
}); 
</code></pre>

<p>You don't need to know where some of those variables are defined and what they are for, the mysterious thing happens on the check for the <code>undefined</code> value.
I obviously check if there already is an object attached to the <code>parent_row_element</code> and if not, create it. It seems like <code>typeof $.data(anything)</code> fails in a way I cannot describe really. If a debugger like Firebug is attached, it evaluates to <code>undefined</code> correctly and everything works fine, without debugger, the assignment to <code>.wf_id</code> always throws because the object is undefined, because it was not created.</p>

<p>It works perfectly if I use this statement:</p>

<pre><code>if(!$.data(parent_row_element, 'changed') )
    $.data(parent_row_element, 'changed', {});
</code></pre>

<p>That's why I guess that this is a bug. Or do I overlook something here ?</p>

<p>I could reproduce this behavior:</p>

<p><strong>throws an error on click, typeof is used</strong><br>
<a href="http://www.jsfiddle.net/5cEVf/" rel="nofollow">http://www.jsfiddle.net/5cEVf/</a></p>

<p><strong>works fine, no typeof</strong><br>
<a href="http://www.jsfiddle.net/5cEVf/3/" rel="nofollow">http://www.jsfiddle.net/5cEVf/3/</a></p>
