jQuery 1.4.2 .data() unexpected behaviour

jQuery 1.4.2 .data() unexpected behaviour

Initially interrogating an unset .data() member returns null (typeof == "object"). After querying the .data() object itself, further tests return the expected 'undefined' for unset data members.

This behaviour is present in 1.4.2 and differs from 1.3.2...I haven't yet tested intermediate versions to see where the behaviour was introduced. It's been tested on both FF3.6 and Safari 4.0.4

This is breaking some code which checks for typeof == "undefined" to test for an unset .data() value.

The following demonstrates the unexpected behaviour -- it will pop up two alerts, the first of which says "object", the second will say "undefined". I would expect them both to say "undefined":

<html>
    <head>
        <script type="text/javascript" src="/static/js/jquery-1.4.2.min.js"></script>
        <script type="text/javascript">
            $(document).ready(function() {
                alert(typeof $('#test').data('foo'));
                $('#test').data();
                alert(typeof $('#test').data('foo'));
            });
        </script>
    </head>
    <body>
        <div id="test">
            Testing...
        </div>
    </body>
</html>