diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-10-06 19:59:07 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-10-06 19:59:07 +0200 |
commit | bedb00603cc91219b09c43256132261fd18a9edd (patch) | |
tree | 6f424e3c3fbf7e5fd1caf0013aaac7449206c37f /Base | |
parent | 5a6c36dc917decc58ec5fbce7d094b82a4af4fc1 (diff) | |
download | serenity-bedb00603cc91219b09c43256132261fd18a9edd.zip |
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>.
Diffstat (limited to 'Base')
-rw-r--r-- | Base/home/anon/www/selectors.html | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Base/home/anon/www/selectors.html b/Base/home/anon/www/selectors.html index 88c248e467..bd06355085 100644 --- a/Base/home/anon/www/selectors.html +++ b/Base/home/anon/www/selectors.html @@ -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> |