I have a potentially infinitely nested tree of ol > li
given an li in the tree, i need to apply some function to all other li
s below the given li
, except within the current ol
. As an example:
for example:
<ol>
<li>
Do not apply to me
<ol>
<li>Do not apply to me</li>
<li>Do not apply to me</li>
</ol>
</li>
<li>
Do not apply to me
<ol>
<li id='given'>I am the "given" li</li> <------------- you are here
<li>Do not apply to me</li>
<li>
Do not apply to me
<ol>
<li>Do not apply to me</li>
<li>Do not apply to me</li>
</ol>
</li>
</ol>
</li>
<li>
Apply to me
</li>
<li>
Apply to me
<ol>
<li>Apply to me</li>
<li>
Apply to me
<ol>
<li>Apply to me</li>
<li>Apply to me</li>
</ol>
</li>
</ol>
</li>
</ol>
What's the most elegant way to achieve this?
Thanks