Select the first div inside a div but only if there are 10 of them
<p>I want to select the first <code>div.favourite-image</code> inside <code>#user-favourites-card</code> only if there are exactly 10 <code>div.favourite-image</code> inside <code>#user-favourites-card</code>.</p>

<p>my attempt:</p>

<pre><code>#user-favourites-card div.favourite-image:nth-last-child(10):first-child
</code></pre>

<p>the html to select from:</p>

<pre><code>&lt;div _ngcontent-qcm-36="" class="card-noshadow" id="user-favourites-card"&gt;
   &lt;div _ngcontent-qcm-36="" class="first-card-header"&gt;
      &lt;h6 _ngcontent-qcm-36=""&gt;Favourites&lt;/h6&gt;
   &lt;/div&gt;
   &lt;div _ngcontent-qcm-36="" class="row"&gt;
      &lt;!--template bindings={
  "ng-reflect-ng-for-of": "[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]"
}--&gt;&lt;div _ngcontent-qcm-36="" class="col-sm-6 col-md-4 col-xl-4"&gt;

         &lt;div _ngcontent-qcm-36="" class="favourite-image" ng-reflect-ng-style="[object Object]" style="background-image: url(&amp;quot;result-images/dairy_free_parmesan_alternative_original.jpg&amp;quot;);"&gt;&lt;/div&gt;
      &lt;/div&gt;&lt;div _ngcontent-qcm-36="" class="col-sm-6 col-md-4 col-xl-4"&gt;

         &lt;div _ngcontent-qcm-36="" class="favourite-image" ng-reflect-ng-style="[object Object]" style="background-image: url(&amp;quot;result-images/dairy_free_mozzarella_alternative.jpg&amp;quot;);"&gt;&lt;/div&gt;
      &lt;/div&gt;&lt;div _ngcontent-qcm-36="" class="col-sm-6 col-md-4 col-xl-4"&gt;

         &lt;div _ngcontent-qcm-36="" class="favourite-image" ng-reflect-ng-style="[object Object]" style="background-image: url(&amp;quot;result-images/dairy_free_tasty_cheese_sauce.jpg&amp;quot;);"&gt;&lt;/div&gt;
      &lt;/div&gt;&lt;div _ngcontent-qcm-36="" class="col-sm-6 col-md-4 col-xl-4"&gt;

         &lt;div _ngcontent-qcm-36="" class="favourite-image" ng-reflect-ng-style="[object Object]" style="background-image: url(&amp;quot;result-images/dairy_free_mild_cheese_mix.jpg&amp;quot;);"&gt;&lt;/div&gt;
      &lt;/div&gt;&lt;div _ngcontent-qcm-36="" class="col-sm-6 col-md-4 col-xl-4"&gt;

         &lt;div _ngcontent-qcm-36="" class="favourite-image" ng-reflect-ng-style="[object Object]" style="background-image: url(&amp;quot;result-images/sugar_free_dark_chocolate_salted_caramel.png&amp;quot;);"&gt;&lt;/div&gt;
      &lt;/div&gt;&lt;div _ngcontent-qcm-36="" class="col-sm-6 col-md-4 col-xl-4"&gt;

         &lt;div _ngcontent-qcm-36="" class="favourite-image" ng-reflect-ng-style="[object Object]" style="background-image: url(&amp;quot;result-images/alpro_drink_for_professional.jpg&amp;quot;);"&gt;&lt;/div&gt;
      &lt;/div&gt;&lt;div _ngcontent-qcm-36="" class="col-sm-6 col-md-4 col-xl-4"&gt;

         &lt;div _ngcontent-qcm-36="" class="favourite-image" ng-reflect-ng-style="[object Object]" style="background-image: url(&amp;quot;result-images/alpro_custard.jpg&amp;quot;);"&gt;&lt;/div&gt;
      &lt;/div&gt;&lt;div _ngcontent-qcm-36="" class="col-sm-6 col-md-4 col-xl-4"&gt;

         &lt;div _ngcontent-qcm-36="" class="favourite-image" ng-reflect-ng-style="[object Object]" style="background-image: url(&amp;quot;result-images/alpro_coconut_dessert.jpg&amp;quot;);"&gt;&lt;/div&gt;
      &lt;/div&gt;&lt;div _ngcontent-qcm-36="" class="col-sm-6 col-md-4 col-xl-4"&gt;

         &lt;div _ngcontent-qcm-36="" class="favourite-image" ng-reflect-ng-style="[object Object]" style="background-image: url(&amp;quot;result-images/alpro_creamy_caramel.jpg&amp;quot;);"&gt;&lt;/div&gt;
      &lt;/div&gt;&lt;div _ngcontent-qcm-36="" class="col-sm-6 col-md-4 col-xl-4"&gt;

         &lt;div _ngcontent-qcm-36="" class="favourite-image" ng-reflect-ng-style="[object Object]" style="background-image: url(&amp;quot;result-images/dairy_free_sour_cream_alternative.jpg&amp;quot;);"&gt;&lt;/div&gt;
      &lt;/div&gt;
   &lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p>aside: I'm wanting to select this exact element to prove there are 10 of them exactly in a Jasmine test.</p>

<p><a href="http://alistapart.com/article/quantity-queries-for-css" rel="nofollow noreferrer">This page</a> shows how it can be done. What am I doing wrong?</p>