I have a slight issue where i need to count nest level of elements.
Problem is that parent element can hold multiple child elements and child elements can have their own child elements.

Please see from where i want to start count (marked with text "I start here").

HTML:

&lt;div class="main_set"&gt;
    &lt;div class="child_set"&gt;
        &lt;div class="child_set"&gt;
            &lt;div class="child_set"&gt;I start here!&lt;/div&gt;
        &lt;/div&gt;
        &lt;div class="child_set"&gt;&lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="child_set"&gt;
        &lt;div class="child_set"&gt;&lt;/div&gt;    
    &lt;/div&gt;
&lt;/div&gt;


I have tried couple things to get count 3.
For example my last attempt:

$(this).closest('.main_set').find('.child_set');


This one obviously returns 6 tho counting all child_sets.

How to count child_set elements from start place to main_set taking into account only nesting. So basically in my example how to get count 3?


Question: What is the purpose of active and passive voice?
Answer: I would like to invite us to consider what would happen if the passive voice did not exist.

To summary StoneyB's answer, the passive voice allows us to not have to mention the Agent (the person who performed the action). This is useful when the Agent is less important, unknown, or someone or something you don't want to mention.

What if we don't have the passive voice?

Consider this text from a Wikipedia page, Merchant of Venice:


  Though classified as a comedy in the First Folio and sharing certain aspects with Shakespeare's other romantic comedies, the play is perhaps most remembered for its dramatic scenes, and is best known for Shylock and the famous "Hath not a Jew eyes?" speech.


Who classified it (the play)? Who remembers it? Who knows it?

It's unclear who did and does (or do) so. The passive voice allows this. Without the passive voice, we would be forced to state the subjects of those clauses explicitly. (And, who forced us so?) The most practical way to rephrase that sentence in active voice is to assume either "we" or "people" as the subject. Let's see what happened if I rewrite the sentence in active voice,


  Though people classify the play as a comedy in the First Folio and the play shares certain aspects with Shakespeare's other romantic comedies, people perhaps remember the play most for its dramatic scenes, and know it best for Shylock and the famous "Hath not a Jew eyes?" speech.


And that is quite awkward.

Let's consider another sentence.
(the credit goes to Cerberus, who give me this great example sentence in our ELL chat room)


  When the dam collapsed, the water was released into the valley.


Who released the water?
The incident? The dam itself? The officers who are responsible for the dam?

And because I don't know who released it, I think we are lucky to have the passive voice around.