Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /css/selectors/selector-required-type-change-001.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<html>
<head>
<title>Check for correctly updating :required matching on type change</title>
<link rel="match" href="selector-required-type-change-001-ref.html">
<style>
span { color: green; }
:required + span { color: red }
</style>
<script>
onload = function() {
document.querySelector("input").type = "button";
}
</script>
</head>
<body>
<input required><span>This should be green</span>
</body>
</html>