1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:27:45 +00:00

LibWeb: Support displaying HTMLInputElement placeholder values

This adds support for parsing the ::placeholder pseudo-element and
injecting an anonymous layout node with that element when the input
element's data is empty.
This commit is contained in:
Timothy Flynn 2022-11-30 22:15:12 -05:00 committed by Tim Flynn
parent fddbc2e378
commit 4a30446999
5 changed files with 91 additions and 0 deletions

View file

@ -1,6 +1,23 @@
<html>
<head>
<style type="text/css">
#placeholder1, #placeholder2 {
color: red;
width: 250px;
}
#placeholder1::placeholder {
color: green;
}
</style>
</head>
<body>
<p>
<input type="hidden" id="hidden" value="hidden" /><br />
<input type="text" id="text" value="text" /><br />
<input type="text" id="placeholder1" placeholder="This placeholder should be green" /><br />
<input type="text" id="placeholder2" placeholder="This placeholder should be grey" /><br />
<input type="search" id="search" value="search" /><br />
<input type="tel" id="tel" value="tel" /><br />
<input type="url" id="url" value="url" /><br />
@ -29,6 +46,8 @@
var ids = [
"hidden",
"text",
"placeholder1",
"placeholder2",
"search",
"tel",
"url",
@ -69,3 +88,5 @@
});
</script>
</body>
</html>