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

LibHTML: Implement some attribute selector support

This patch adds a[foo] and a[foo=bar] attribute selectors.

Note that an attribute selector is an optional part of a selector
component, and not a component on its own.
This commit is contained in:
Andreas Kling 2019-11-21 20:07:43 +01:00
parent 54a6ae9201
commit 8946e50986
6 changed files with 115 additions and 8 deletions

View file

@ -0,0 +1,19 @@
<html>
<head>
<title>CSS attribute selector test</title>
<style type="text/css">
div[id="foo"] {
background-color: blue;
color: #fff;
}
div[cool] {
background-color: green;
color: #ffffff;
}
</style>
</head>
<body>
<div id="foo">This div has id="foo" and is bloo!</div>
<div cool="">This div has a "cool" attribute and a cool green color.</div>
</body>
</html>

View file

@ -25,6 +25,7 @@ h1 {
<ul>
<li><a href="small.html">small</a></li>
<li><a href="css.html">css</a></li>
<li><a href="attrselectors.html">attribute selectors</a></li>
<li><a href="lorem.html">lorem ipsum</a></li>
<li><a href="phint.html">presentational hints</a></li>
<li><a href="images.html">images</a></li>