Skip to content

Commit

Permalink
Only render experimental examples section when experimental examples …
Browse files Browse the repository at this point in the history
…present
  • Loading branch information
stalgiag committed Jun 10, 2024
1 parent 9ee1942 commit d4e4c32
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
6 changes: 1 addition & 5 deletions content/index/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -904,11 +904,7 @@ <h2 id="examples_by_props_label">Examples By Properties and States</h2>
</tr></tbody>
</table>
</section>
<section id="examples_experimental">
<h2 id="examples_experimental_label">Experimental Examples</h2>
<div><strong>NOTE:</strong> The HC abbreviation means example has High Contrast support.</div>
<ul id="examples_experimental_ul"></ul>
</section>

</main>


Expand Down
9 changes: 7 additions & 2 deletions scripts/reference-tables.js
Original file line number Diff line number Diff line change
Expand Up @@ -407,9 +407,14 @@ const examplesExperimental = indexOfExperimentalContent
.map(exampleListItem)
.join('');

$('#examples_by_props_tbody').html(examplesByProps);
if (examplesExperimental.length === 0) {
// Do no display the experimental section if there are no experimental examples
$('#examples_experimental').remove();
} else {
$('#examples_experimental_ul').html(examplesExperimental);
}

$('#examples_experimental_ul').html(examplesExperimental);
$('#examples_by_props_tbody').html(examplesByProps);

// cheerio seems to fold the doctype lines despite the template
const result = $.html()
Expand Down

0 comments on commit d4e4c32

Please sign in to comment.