Skip to main content

Bug Tracker

Side navigation

#14482 closed bug (notabug)

Opened October 24, 2013 12:59PM UTC

Closed October 24, 2013 01:14PM UTC

children method doesn't work as the example shows

Reported by: diegoperl@gmail.com Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.10.2
Keywords: Cc:
Blocked by: Blocking:
Description

according to the API documentation on children(), i should get only first level children which matches the selector.

I tested the example given in the documentation with some little change:

html:

<ul class="level-1">

<li class="item-i">I</li>

<li class="item-ii">II

<ul class="level-2">

<li class="item-a">A</li>

<li class="item-a">B

<ul class="level-3">

<li class="item-a">1</li>

<li class="item-a">2</li>

<li class="item-a">3</li>

</ul>

</li>

<li class="item-c">C</li>

</ul>

</li>

<li class="item-iii">III</li>

</ul>

js:

$( "ul.level-2" ).children("item-a").css( "background-color", "red" );

according to the documentation, this should color only A,B and C, but it also colors 1,2 and 3 which is what i would expect from method find()

Attachments (0)
Change History (1)

Changed October 24, 2013 01:14PM UTC by scottgonzalez comment:1

resolution: → notabug
status: newclosed

That's how CSS works. If you inspect the applied styles, you'll see they're only applied to the direct children, but they cascade down. If you need more help, please use the forums or Stack Overflow.