Norėdami parodyti leidžiamų ir nepalaikomų funkcijų ar metodų sąrašą arba lentelę, naudokite class="compare-yes"
ir class="compare-no"
. Norėdami palyginti patvirtintus ir nerekomenduojamus metodus, naudokite class="compare-better"
ir class="compare-worse"
.
Šie pavyzdžiai parodo, kaip šios klasės įterpia tinkamas piktogramas ir formuoja teksto stilių.
Nerekomenduojama – įtrauka su skirtukais
(bad sample code)
<p><span class="compare-worse">Not recommended</span> — indent with tabs</p>
<pre class="prettyprint">
(bad sample code)
</pre>
Rekomenduojama – įtrauka su tarpais
(good sample code)
<p><span class="compare-better">Recommended</span> — indent with spaces</p>
<pre class="prettyprint">
(good sample code)
</pre>
Toliau pateiktame pavyzdyje parodyta, kaip šias klases naudoti palyginimo lentelėje.
Tolesniuose skirtukuose rodomas šios pavyzdinės palyginimo lentelės pagrindinės ir su pritaikymu neįgaliesiems suderinamos versijos šaltinio kodas.
Su pritaikymu neįgaliesiems suderinama versija reikalinga pagalbinėms technologijoms, pvz., ekrano skaitytuvams, palaikyti. Šioje versijoje kiekviename lentelės langelyje yra tuščias <span>
elementas su aria-label
, kuri naudojama prasmingam pagalbos tekstui pateikti. Kadangi pagalbos tekstas dokumentuos palyginimą, taip pat galite pridėti aria-hidden="true"
prie eilučių ir stulpelių antraščių.
Pagrindinis
<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>
Suderinamas su 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>