Looks like a bug to me. In this case it seems like doing just "li"
would be equivalent to what you want. Could you file it here?
http://dev.jquery.com/newticket

--John



On Mon, Feb 23, 2009 at 11:43 AM, Sjeiti <sje...@gmail.com> wrote:
>
> I've build a recursive tree. Now I'm trying to get the number of list
> elements but I get weirds results:
> $("li").length = 10;
> $("body>ul li").length = 4;
> Is this right?.. or a bug...
> (1.2.6 works as expected)
>
>
> [code]
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://
> www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml";>
>        <head>
>                <meta http-equiv="Content-Type" content="text/html; 
> charset=utf-8" /
>>
>                <!--script type="text/javascript" src="scripts/
> jquery-1.2.6.min.js"></script-->
>                <script type="text/javascript" 
> src="scripts/jquery-1.3.2.min.js"></
> script>
>                <script type="text/javascript">
>                        $(function(){
>                                $("body").prepend("$(\"body>ul li\").length = 
> "+        $("body>ul
> li").length     +";<br/>");
>                                $("body").prepend("$(\"li\").length = "+       
>  $("li").length  +";<br/
>>");
>                        });
>                </script>
>        </head>
>        <body>
>                <ul>
>                        <li>
>                                <span>a</span>
>                                <ul>
>                                        <li>
>                                                <span>aa</span>
>                                        </li>
>                                        <li>
>                                                <span>ab</span>
>                                        </li>
>                                        <li>
>                                                <span>ac</span>
>                                                <ul>
>                                                        <li>
>                                                                
> <span>aca</span>
>                                                        </li>
>                                                        <li>
>                                                                
> <span>acb</span>
>                                                        </li>
>                                                        <li>
>                                                                
> <span>acc</span>
>                                                        </li>
>                                                </ul>
>                                        </li>
>                                </ul>
>                        </li>
>                        <li>
>                                <span>b</span>
>                        </li>
>                        <li>
>                                <span>c</span>
>                        </li>
>                        <li>
>                                <span>d</span>
>                        </li>
>                </ul>
>        </body>
> </html>
> [/code]

Reply via email to