Salīdzinājumi

Lai parādītu atļauto un neatbalstīto funkciju vai paņēmienu sarakstu vai tabulu, izmantojiet class="compare-yes" un class="compare-no" . Lai salīdzinātu apstiprinātās un neieteiktās pieejas, izmantojiet class="compare-better" un class="compare-worse" .

Šie piemēri parāda, kā šīs klases ievieto atbilstošas ​​ikonas un veido teksta stilu.

Nav ieteicams — atkāpe ar cilnēm

(bad sample code)
<p><span class="compare-worse">Not recommended</span> — indent with tabs</p>
<pre class="prettyprint">
(bad sample code)
</pre>

Ieteicams — atkāpe ar atstarpēm

(good sample code)
<p><span class="compare-better">Recommended</span> — indent with spaces</p>
<pre class="prettyprint">
(good sample code)
</pre>

Šis piemērs parāda, kā izmantot šīs klases salīdzināšanas tabulā.

Šajās cilnēs ir parādīts šīs salīdzināšanas parauga tabulas pamata un ar pieejamību saderīgās versijas avota kods.

Ar pieejamību saderīga versija ir nepieciešama, lai atbalstītu palīgtehnoloģijas, piemēram, ekrāna lasītājus. Šajā versijā katrā tabulas šūnā ir tukšs elements <span> ar aria-label , ko izmanto, lai nodrošinātu jēgpilnu palīdzības tekstu. Tā kā palīdzības teksts dokumentēs salīdzinājumu, varat arī pievienot aria-hidden="true" rindu un kolonnu galvenēm.

Pamata

<table>
  <tr>
    <th>Resource Type</th>
    <th><code>list</code></th>
    <th><code>insert</code></th>
    <th><code>update</code></th>
    <th><code>delete</code></th>
  </tr>
  <tr>
    <td><code>activity</code></td>
    <td><span class="compare-yes"></span></td>
    <td><span class="compare-yes"></span></td>
    <td><span class="compare-no"></span></td>
    <td><span class="compare-no"></span></td>
  </tr>
  <tr>
    <td><code>channel</code></td>
    <td><span class="compare-yes"></span></td>
    <td><span class="compare-no"></span></td>
    <td><span class="compare-no"></span></td>
    <td><span class="compare-no"></span></td>
  </tr>
  <tr>
    <td><code>channelBanner</code></td>
    <td><span class="compare-no"></span></td>
    <td><span class="compare-yes"></span></td>
    <td><span class="compare-no"></span></td>
    <td><span class="compare-no"></span></td>
  </tr>
</table>

Saderīgs ar A11y

<table>
  <tr aria-hidden="true">
    <th>Resource Type</th>
    <th><code>list</code></th>
    <th><code>insert</code></th>
    <th><code>update</code></th>
    <th><code>delete</code></th>
  </tr>
  <tr>
    <td aria-hidden="true"><code>activity</code></td>
    <td><span aria-label="The activity resource type has a list method" class="compare-yes"></span></td>
    <td><span aria-label="The activity resource type has an insert method" class="compare-yes"></span></td>
    <td><span aria-label="The activity resource type does not have an update method" class="compare-no"></span></td>
    <td><span aria-label="The activity resource type does not have a delete method" class="compare-no"></span></td>
  </tr>
  <tr>
    <td aria-hidden="true"><code>channel</code></td>
    <td><span aria-label="The channel resource type has a list method" class="compare-yes"></span></td>
    <td><span aria-label="The channel resource type does not have an insert method" class="compare-no"></span></td>
    <td><span aria-label="The channel resource type does not have an update method" class="compare-no"></span></td>
    <td><span aria-label="The channel resource type does not have a delete method" class="compare-no"></span></td>
  </tr>
  <tr>
    <td aria-hidden="true"><code>channelBanner</code></td>
    <td><span aria-label="The channelBanner resource type does not have a list method" class="compare-no"></span></td>
    <td><span aria-label="The channelBanner resource type has an insert method" class="compare-yes"></span></td>
    <td><span aria-label="The channelBanner resource type does not have an update method" class="compare-no"></span></td>
    <td><span aria-label="The channelBanner resource type does not have a delete method" class="compare-no"></span></td>
  </tr>
</table>