SO - 11135693
HTML
<div id="test">
DIV#test
</div>
<div>
<div>
DIV#test + DIV > DIV:first-child
</div>
<div>
<div>
<div>
DIV#test + DIV > DIV:first-child + DIV > DIV:first-child > DIV:first-child
</div>
DIV#test + DIV > DIV:first-child + DIV > DIV:first-child
</div>
DIV#test + DIV > DIV:first-child + DIV
</div>
DIV#test + DIV
</div>
CSS
.l1 {
color: red;
}
.l2 {
color: blue;
}
.l3 {
color: green;
}
.l4 {
color: maroon;
}
.l5 {
color: pink;
}
.l6 {
color: purple;
}
JavaScript
jQuery("DIV#test").append("T1");
jQuery("DIV#test + DIV ").append("T2");
jQuery("DIV#test + DIV > DIV:first-child").append("T3");
jQuery("DIV#test + DIV > DIV:first-child + DIV").append("T4");
jQuery("DIV#test + DIV > DIV:first-child + DIV > DIV:first-child").append("T5");
jQuery("DIV#test + DIV > DIV:first-child + DIV > DIV:first-child > DIV:first-child").append("T6");