Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /css/css-pseudo/selection-background-color-non-applicable-properties.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Pseudo-Elements Test: ::selection rule with only non-applicable properties doesn't clear the default background</title>
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
<link rel="match" href="selection-background-color-non-applicable-properties-ref.html">
<meta name="assert" content="An author ::selection rule that only specifies properties that don't apply to highlight pseudo-elements (like border-radius or padding) contributes no declarations, so the selection is still painted using the default highlight colors.">
<script src="support/selections.js"></script>
<style>
div {
font-size: 300%;
}
div::selection {
border-radius: 2px;
padding: 4px 0;
}
</style>
<p>Test passes if "Selected Text" appears selected using the OS selection colors.
<div id="test">Selected Text</div>
<script>selectNodeContents(document.getElementById("test"));</script>