I'm trying to get the "depth" of an ordered list. I need to know what the
"deepest" branch of the list is. My data looks like:

<ul>
  <li>
    Item 1
    <ul>
        <li>
        Item 1.a
       </li>
        <li>
        Item 1.b
       </li>
    </ul>
  </li>
  <li>
    Item 2
  </li>
  <li>
    Item 3
    <ul>
        <li>
        Item 3.a
        <ul>
          <li>Item 3.a.i</li>
          <li>Item 3.a.ii</li>
          <li>Item 3.a.iii</li>
       </li>
        <li>
        Item 3.b
       </li>
    </ul>
  </li>
  <li>
    Item 4
  </li>
</ul>

I need to know that the deepest branch is 3 nodes deep (i.e. Item 3.a.i). I
can get this using recursion or loop through all the <ul> nodes, but I'm
wondering if I'm missing an obviously selector that will get me the same
information.

-Dan

Reply via email to