1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 23:37:36 +00:00

LibHTML: Support the :first-child and :last-child pseudo classes

This commit is contained in:
Andreas Kling 2019-12-16 19:34:52 +01:00
parent 870df4a8c6
commit c1474e594e
6 changed files with 63 additions and 0 deletions

View file

@ -0,0 +1,24 @@
<html>
<head>
<title>:first-child test</title>
<style>
p:first-child {
color: lime;
background-color: black;
padding: 5px;
}
</style>
</head>
<body>
<div>
<p>This text is selected!</p>
<p>This text isn't selected.</p>
</div>
<div>
<h2>This text isn't selected: it's not a `p`.</h2>
<p>This text isn't selected.</p>
</div>
</body>
</html>

View file

@ -0,0 +1,23 @@
<html>
<head>
<title>:last-child test</title>
<style>
p:last-child {
color: lime;
background-color: black;
padding: 5px;
}
</style>
</head>
<body>
<div>
<p>This text isn't selected.</p>
<p>This text is selected!</p>
</div>
<div>
<p>This text isn't selected.</p>
<h2>This text isn't selected: it's not a `p`.</h2>
</div>
</body>
</html>

View file

@ -24,6 +24,8 @@ h1 {
<p>Some small test pages:</p>
<ul>
<li><a href="small.html">small</a></li>
<li><a href="first-child.html">:first-child</a></li>
<li><a href="last-child.html">:last-child</a></li>
<li><a href="form.html">form</a></li>
<li><a href="borders.html">borders</a></li>
<li><a href="css.html">css</a></li>