Files
sousa-gecko/testing/web-platform/tests/css/css-highlight-api/highlight-image.html
T
Jan-Niklas Jaeschke f3aad557f7 Bug 2028359 - CSS Highlight API: Paint highlights in image frames. r=layout-reviewers,dshin,emilio
This patch also fixes the broken WPT (the static range points to children
of an element that doesn't have child nodes and therefore is invalid).

Differential Revision: https://phabricator.services.mozilla.com/D291404
2026-04-02 12:47:33 +00:00

28 lines
905 B
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Custom highlight pseudo elements over images.</title>
<link rel="help" href="https://drafts.csswg.org/css-highlight-api-1/#creating-highlights">
<link rel="mismatch" href="highlight-image-notref.html">
<meta name="assert" content="Highlights should be able to be specified over images.">
<style>
::highlight(example-highlight1) {
background-color: rgba(200,0,0,.5);
color:green;
}
</style>
</head>
<body>
<div id="img1"><img src="../../images/blank-highlight.png"></div>
<script>
let imageElement1 = document.getElementById('img1');
let highlight1 = new Highlight(new StaticRange({startContainer: imageElement1, startOffset: 0, endContainer: imageElement1, endOffset: 1}));
CSS.highlights.set("example-highlight1", highlight1);
</script>
</body>
</html>