If it's not a bug it is at least violates the principle of least
surprise.

The .is function returns true for things I don't think it should.  See
the example below.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
        <head>
                <title>bug?</title>
                <script type="text/javascript" 
src="http://ajax.googleapis.com/ajax/
libs/jquery/1.2.6/jquery.js"></script>
                <script type="text/javascript">
                        function bodgyIs(el, selector)
                        {
                                var el1 = el[0], candidates = $(selector);
                                for (var i=0, el2; el2 = candidates[i]; i++)
                                {
                                        if (el1 == el2) return true;
                                }
                                return false;
                        }

                        $(document).ready(function ()
                        {
                                var selector = "#test .test";
                                var el = $("#dontFindMe")
                                alert(el.is(selector));
                                alert(bodgyIs(el, selector));
                        });
                </script>
        </head>
        <body>
                <div id="dontFindMe"></div>
        </body>
</html>

Reply via email to