[jQuery] Bug in jQuery selector or am I just not understanding?

[jQuery] Bug in jQuery selector or am I just not understanding?


Why does the code below show the values for the two alerts to be:
bilbo and layout_1 ?
I would have expected: bilbo and bilbo.
I thought the cascading selectors would have chosen the dp_properties
class that is the first child level of the selected div. . .not the
dp_properties class buried two levels down (but appearing first in the
DOM listing).
I would have thought that I would have had to use more selectors to
get into there specifically?
This really breaks my thinking of how jQuery works. Do I really need
to know what elements are in between to know that a selector is
working properly? What syntax would I use to get the one I want (the
last and outermost)?
Thoughts, answers, fixes?
Thanks,
ml
alert( $( "#395" ).attr("dp_id") );
alert( $( "#395" .dp_properties" ).attr( "dp_id" ) );
<div id="395" dp_id="bilbo">
    <div class="dp_view_container">
        <div id="411" dp_id="layout_1" dp_id_num="411">
            <div class="dp_properties" dp_id_num="411" dp_id="layout_1"></div>
        </div>
    </div>
    <div class="dp_properties" dp_id_num="395" dp_id="bilbo"></div>
</div>