summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-highlight-api/painting/custom-highlight-painting-004-2.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/css/css-highlight-api/painting/custom-highlight-painting-004-2.html')
-rw-r--r--testing/web-platform/tests/css/css-highlight-api/painting/custom-highlight-painting-004-2.html33
1 files changed, 33 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-highlight-api/painting/custom-highlight-painting-004-2.html b/testing/web-platform/tests/css/css-highlight-api/painting/custom-highlight-painting-004-2.html
new file mode 100644
index 0000000000..044cdb5d64
--- /dev/null
+++ b/testing/web-platform/tests/css/css-highlight-api/painting/custom-highlight-painting-004-2.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<meta charset="UTF-8">
+<title>CSS Highlight API Test: </title>
+<link rel="help" href="https://drafts.csswg.org/css-highlight-api-1/">
+<link rel="match" href="custom-highlight-painting-004-2-ref.html">
+<meta name="assert" value="When painting overlapping highlights with the same .priority, the one added last should be painted on top; and style properties not defined by the one on top (background-color in this case) should follow the rules of the next Highlight from top to bottom until there's one that overwrites default (or use default value otherwise).">
+<style>
+ ::highlight(foo) {
+ color:blue;
+ background-color:yellow;
+ }
+ ::highlight(bar) {
+ color:orange;
+ }
+</style>
+<body>Some text
+<script>
+ let textNode = document.body.firstChild;
+
+ let r1 = new Range();
+ r1.setStart(textNode, 0);
+ r1.setEnd(textNode, 6);
+
+ let r2 = new Range();
+ r2.setStart(textNode, 3);
+ r2.setEnd(textNode, 9);
+
+ let h1 = new Highlight(r1);
+ let h2 = new Highlight(r2);
+
+ CSS.highlights.set("foo", h1);
+ CSS.highlights.set("bar", h2);
+</script> \ No newline at end of file