Bug Tracker

Opened 13 years ago

Closed 13 years ago

#5593 closed bug (worksforme)

DOM parent()

Reported by: piotrpolak Owned by:
Priority: major Milestone: 1.4
Component: core Version: 1.3.2
Keywords: Cc:
Blocked by: Blocking:


The result of the following code

#1 $( $("ul.subsubmenu li a.active").parent() ).parent().children("li").children("a");

differs from

#2 $("ul.subsubmenu li a.active").parent().children("a");

In the case #2 it returns the same "a" element having class "active". The desired behavior (case #1) is to select all "a" elements from the list having an "a" element having class ".active".

Here is an example HTML code: <ul>

<li><a href="xx.html">xxx</a></li> <li><a href="zz.html">zz</a>

<ul class="subsubmenu">

<li><a href="cc.html">cc</a></li> <li><a href="ccx.html">ccx</a></li>


</li> <li><a href="qqq.html">qqq</a></li> <li><a href="eventy.html" class="active">fff</a>

<ul class="subsubmenu">

<li><a href="ll.html" class="active">ll/a></li> <li><a href="bb.html">bb</a></li>




Change History (1)

comment:1 Changed 13 years ago by john

Component: unfilledcore
Resolution: worksforme
Status: newclosed

That's because you're not walking far enough up the tree - case #1 is correct for this particular use case (although you don't need to wrap the jQuery set a second time).

Note: See TracTickets for help on using tickets.