-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Expand file tree
/
Copy pathselection-intercharacter-012.html
More file actions
50 lines (39 loc) · 1.66 KB
/
selection-intercharacter-012.html
File metadata and controls
50 lines (39 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<!DOCTYPE html>
<meta charset="UTF-8">
<title>CSS Pseudo-Elements Test: active selection and inter-character spacing</title>
<link rel="author" title="Gérard Talbot" href="https://umn0mtkzgjf7agq47p8f6wr.julianrbryant.com/BrowserBugsSection/css21testsuite/">
<link rel="help" href="https://un5gmtkzgkj46tygt32g.julianrbryant.com/TR/css-pseudo-4/#highlight-bounds">
<link rel="help" href="https://un5gmtkzgkj46tygt32g.julianrbryant.com/TR/css-text-3/#letter-spacing-property">
<link rel="match" href="reference/selection-intercharacter-012-ref.html">
<meta content="may" name="flags">
<meta name="assert" content="In this test, the 'c' and the 't' characters share the same level in the containment hierarchy but the space between these characters does not. Therefore, only the 'c' and the 't' characters themselves have an orange background color painting.">
<link rel="stylesheet" href="support/highlights.css">
<style>
div
{
font-size: 48px;
letter-spacing: 1em;
}
div::selection
{
background-color: yellow;
}
span::selection
{
background-color: orange;
}
</style>
<script>
function startTest()
{
var targetRange = document.createRange();
/* We first create an empty range */
targetRange.selectNodeContents(document.getElementById("test"));
/* Then we set the range boundaries to the children of div#test */
window.getSelection().addRange(targetRange);
/* Finally, we now select such range of content */
}
</script>
<body onload="startTest();">
<p>Test passes if the background of characters "c" and "t" is orange and if the space between those 2 characters is yellow (and not orange).
<div id="test" class="highlight_reftest">Sele<span>c</span> <span>t</span>ed</div>