Skip to main content

Bug Tracker

Side navigation

#5593 closed bug (worksforme)

Opened December 03, 2009 08:33PM UTC

Closed December 10, 2009 06:05AM UTC

DOM parent()

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

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>

</ul>

</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>

</ul>

</li>

</ul>

Attachments (0)
Change History (1)

Changed December 10, 2009 06:05AM UTC by john comment:1

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).