OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 |
2 <html> | 3 <html> |
3 <head> | 4 <head> |
4 <style> | 5 <style> |
5 .group { | |
6 display: inline-block; | |
7 position: relative; | |
8 width: 150px; | |
9 height: 500px; | |
10 } | |
11 | |
12 #overflow { | 6 #overflow { |
13 width: 600px; | 7 width: 600px; |
14 height: 550px; | 8 height: 450px; |
15 overflow: hidden; /* Still scrollable with JS */ | 9 overflow: hidden; /* Still scrollable with JS */ |
16 border: 1px solid black; | 10 border: 1px solid black; |
17 } | 11 } |
18 | 12 |
19 .spacer { | 13 .group { |
20 float: left; | 14 position: relative; |
21 width: 10px; | 15 width: 500px; |
22 height: 1200px; | 16 height: 150px; |
23 } | 17 } |
| 18 |
24 .container { | 19 .container { |
25 width: 100px; | 20 width: 400px; |
26 height: 400px; | 21 height: 130px; |
27 outline: 2px solid black; | 22 outline: 2px solid black; |
28 } | 23 } |
29 | 24 |
30 .box { | 25 .box { |
31 width: 100px; | 26 width: 200px; |
32 height: 200px; | 27 height: 130px; |
33 } | 28 } |
34 | 29 |
35 .sticky { | 30 .sticky { |
36 position: sticky; | 31 position: sticky; |
37 top: 100px; | 32 left: 100px; |
| 33 right: 200px; |
38 background-color: green; | 34 background-color: green; |
39 } | 35 } |
40 | 36 |
41 .indicator { | 37 .indicator { |
42 position: absolute; | 38 position: absolute; |
43 top: 0; | 39 top: 0; |
44 left: 0; | 40 left: 0; |
45 background-color: red; | 41 background-color: red; |
46 } | 42 } |
47 </style> | 43 </style> |
48 <script> | 44 <script> |
49 function doTest() | 45 function doTest() |
50 { | 46 { |
51 document.getElementById('overflow').scrollTop = 120; | 47 document.getElementById('overflow').scrollLeft = 100; |
52 } | 48 } |
53 window.addEventListener('load', doTest, false); | 49 window.addEventListener('load', doTest, false); |
54 </script> | 50 </script> |
55 </head> | 51 </head> |
56 <body> | 52 <body> |
57 This test checks that sticky positioned elements are contained by their enclosin
g ancestor with an overflow clip. | 53 This test checks that right offset is ignored with overconstrained sticky positi
oning and ltr text direction. |
58 There should be no red. | 54 There should be no red. |
59 <div id="overflow"> | 55 <div id="overflow"> |
60 <div class="spacer"></div> | |
61 <div class="group"> | 56 <div class="group"> |
62 <div class="indicator box" style="top: 200px;"></div> | 57 <div class="indicator box" style="left: 200px;"></div> |
63 <div class="container"> | 58 <div class="container"> |
64 <div class="sticky box"></div> | 59 <div class="sticky box"></div> |
65 </div> | 60 </div> |
66 </div> | 61 </div> |
67 | 62 |
68 <div class="group" style="top: 100px"> | 63 <div class="group" style="left: 100px"> |
69 <div class="indicator box" style="top: 120px;"></div> | 64 <div class="indicator box" style="left: 100px;"></div> |
70 <div class="container"> | 65 <div class="container"> |
71 <div class="sticky box"></div> | 66 <div class="sticky box"></div> |
72 </div> | 67 </div> |
73 </div> | 68 </div> |
74 | 69 |
75 <div class="group" style="top: 240px"> | 70 <div class="group" style="left: 200px"> |
76 <div class="indicator box" style="top: 0;"></div> | 71 <div class="indicator box" style="left: 0;"></div> |
77 <div class="container"> | 72 <div class="container"> |
78 <div class="sticky box"></div> | 73 <div class="sticky box"></div> |
79 </div> | 74 </div> |
80 </div> | 75 </div> |
81 </div> | 76 </div> |
82 </body> | 77 </body> |
83 </html> | 78 </html> |
OLD | NEW |