-
Notifications
You must be signed in to change notification settings - Fork 6
/
index.html
64 lines (59 loc) · 2.8 KB
/
index.html
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Range.getClientRects fix demo</title>
<link rel="stylesheet" href="demo/demo.css">
</head>
<body>
<div class="cols"><div class="col col-text">
<h2>Select text here</h2>
<div class="ce" contentEditable="true" spellcheck="false">
<p>Creating a text selection from here to the next paragraph will result in too many rectangles in Chrome <= 54.</p>
<p>Praesent a convallis magna. <b>Fusce rutrum finibus purus ut blandit. Donec ultrices nunc sit amet felis semper, et auctor lorem auctor. <i>Donec purus libero, sagittis vitae quam sit amet,</i> volutpat tristique purus. Nam eleifend sodales nulla a consequat.</b> Donec malesuada blandit quam, luctus semper nisl tempus tempor. Quisque egestas malesuada consectetur.</p>
<p>In the next paragraph place your cursor inside 'Lorem' then extend the selection right over the image (shift+right). When you shrink the selection back with shift+left you will get too many rectangles in Firefox.</p>
<p class="testNode1">Lorem <u><img src="example.png"> ipsum </u></p>
<p class="testNode2" style="width: 26px;">Foo bar</p>
</div>
</div><div class="col col-preview">
<h2>Native</h2>
<div class="ce-mirror"></div>
<div class="highlights highlights-native"></div>
</div><div class="col col-preview">
<h2>Fixed</h2>
<div class="ce-mirror"></div>
<div class="highlights highlights-fixed"></div>
</div></div>
<div class="col">
<p>
Some programmatically created selections can also be problematic:
</p>
<p>
<input type="button" value="Firefox/Safari bug" class="testRange" data-range="1" />
<input type="button" value="Chrome 55 bug" class="testRange" data-range="2" />
</p>
<p>
This selection can be created by triple clicking in Firefox, but will also break in Chrome if set programmatically:
</p>
<p>
<input type="button" value="Firefox triple click bug" class="testRange" data-range="3" />
</p>
<p>
Selecting across line wraps can cause bounding rect bugs:
</p>
<p>
<input type="button" value="Chrome" class="testRange" data-range="4" />
<input type="button" value="Firefox" class="testRange" data-range="5" />
</p>
</div>
<table class="features">
<caption>Bug detection</caption>
<tr><td>getClientRects</td><td class="isBroken-getClientRects"></td></tr>
<tr><td>getBoundingClientRect</td><td class="isBroken-getBoundingClientRect"></td></tr>
<tr><td>Browser zoom</td><td class="isBroken-ieZoom"></td></tr>
</table>
<script src="https://code.jquery.com/jquery-3.6.0.slim.min.js" integrity="sha384-Qg00WFl9r0Xr6rUqNLv1ffTSSKEFFCDCKVyHZ+sVt8KuvG99nWw5RNvbhuKgif9z" crossorigin="anonymous"></script>
<script src="rangefix.js"></script>
<script src="demo/demo.js"></script>
</body>
</html>