mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:37:35 +00:00
LibHTML: Add adjacent (+) and general (~) sibling combinators
This patch implements two more selector features: - "div + p" matches the <p> sibling immediately after a <div>. - "div ~ p" matches all <p> siblings after a <div>.
This commit is contained in:
parent
5a6c36dc91
commit
bedb00603c
5 changed files with 53 additions and 2 deletions
|
@ -15,6 +15,11 @@ div > .boo > .bee {
|
|||
background-color: #000000;
|
||||
color: #ff00ff;
|
||||
}
|
||||
#gen_sib ~ div,
|
||||
#adj_sib + div {
|
||||
background-color: #0000ff;
|
||||
color: #ffffff;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
@ -45,5 +50,16 @@ div > .boo > .bee {
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div id="gen_sib">All the siblings of this <div> should be blue.</div>
|
||||
<div>First sibling (should be blue)</div>
|
||||
<div>Second sibling (should be blue)</div>
|
||||
</div>
|
||||
<div>
|
||||
<div id="adj_sib">The first sibling of this <div> should be blue.</div>
|
||||
<div>First sibling (should be blue)</div>
|
||||
<div>Second sibling (should not be blue)</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue