Please ignore secret bonuses. Secret tests do NOT award bonus. Max hw grade is 30+2 bonus efficiency

Do you need help?

Notice Board

Dubbio sul meccanismo del selettore CSS

francesco.dev (33560 points)
22 51 129
in Es3 by (33.6k points)
closed by

Buonasera a tutti!

Ho notato che il test test_program3_12 mi dà errore.

Il problema è il seguente:
Avendo il selettore               selettore  =  @[class="container"]  >  .main-wrap  #firehose  >  .row  strong

Stiamo dicendo che dobbiamo cercare:
Un qualsiasi tag che contiene  class="container"
Il figlio, presente nel livello immediatamente sotto, deve avere  class="... main-wrap ..."  e  id="firehose"
Il figlio immediatamente sotto il figlio precedente deve avere  class="row"
Quest'ultimo figlio deve avere (a qualsiasi profondità) il tag  strong

Il problema è che nel file slashdot.html non è presente una struttura che rispetta quella appena spiegata!
L'unica che gli si avvicina è la seguente:

<div class="container">
            <div class="main-wrap has-rail-right">
                <div class="main-content">
                    <div class="nothumbs" id="firehose">
                        <a id="articles" name="articles"></a>
                        <div class="fhroot row" id="firehoselist">
                            <div id="announcement">
                                   <strong><a href="https://slashdot.org/newsletter">Sign up for the Slashdot Daily Newsletter!</a></strong>
                                   <strong>DEAL:</strong> For $25 -
                                   <strong><a href="http://hshd.io/nuLx" rel="nofollow" target="_blank">Add A Second Phone Number To Your Smartphone for life! Use promo code SLASHDOT25.</a></strong>


Molto probabilmente non ho ancora capito appieno il meccanismo del selettore.
Vi lascio due domande:

Prima domanda:
Il simbolo  >  significa che dobbiamo controllare solo i figli di un tag padre?

Seconda domanda:
Quando ho un selettore del tipo:  .main-wrap  #firehose
Vuol dire che devo trovare un tag che abbia come class="... main-wrap ..." e id="firehose"
Oppure che devo trovare un tag che abbia solo come class="... main-wrap ..." e che contenga un tag (a qualsiasi profondità) che abbia id="firehose" ?

Grazie mille per la disponibilità!
- Francesco Pio Scognamiglio

582 views
closed with the note: answered

1 Answer

Best answer
andrea.sterbini (207940 points)
756 1270 2377
by (208k points)
selected by

La seconda che hai detto (come direbbe Guzzanti)

@[class="container"]  >  .main-wrap  #firehose  >  .row  strong

vuol dire:

  1. da qualche parte c'è un nodo con attributo class="container" (esattamente così, non come .container)
  2. ha un figlio con attributo class che contiene main-wrap
  3. che contiene a qualsiasi livello di profondità (da figlio in giù) un tag con id="firehose"
  4. che ha come figlio un tag con class che contiene row
  5. che contiene a qualsiasi profondità un tag strong (che va tornato)

francesco.dev (33560 points)
22 51 129
by (33.6k points)
Perfetto, ho capito
Grazie mille