Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /css/css-highlight-api/painting/custom-highlight-painting-priority-text-decoration-001.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<html>
<head>
<title>CSS Highlight API Test: ::highlight text-decoration paints over higher priority when not clashing</title>
<link rel="match" href="custom-highlight-painting-priority-text-decoration-001-ref.html">
<style>
::highlight(yellow-highlight) {
background-color: yellow;
}
::highlight(underline-highlight) {
text-decoration: underline;
text-decoration-color: red;
}
</style>
</head>
<body>
<span id="yellow-highlight">Yellow</span>
<script>
let yellow = document.getElementById("yellow-highlight");
let highlightYellow = new Highlight(new StaticRange({
startContainer: yellow.childNodes[0],
startOffset: 0,
endContainer: yellow.childNodes[0],
endOffset: 6
}));
let highlightUnderline = new Highlight(new StaticRange({
startContainer: yellow.childNodes[0],
startOffset: 0,
endContainer: yellow.childNodes[0],
endOffset: 6
}));
CSS.highlights.set("yellow-highlight", highlightYellow);
CSS.highlights.set("underline-highlight", highlightUnderline);
highlightYellow.priority = 10;
</script>
</body>
</html>