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; |
| 23 direction: rtl; |
28 } | 24 } |
29 | 25 |
30 .box { | 26 .box { |
31 width: 100px; | 27 width: 200px; |
32 height: 200px; | 28 height: 130px; |
33 } | 29 } |
34 | 30 |
35 .sticky { | 31 .sticky { |
36 position: sticky; | 32 position: sticky; |
37 top: 100px; | 33 left: 600px; |
| 34 right: 100px; |
38 background-color: green; | 35 background-color: green; |
39 } | 36 } |
40 | 37 |
41 .indicator { | 38 .indicator { |
42 position: absolute; | 39 position: absolute; |
43 top: 0; | 40 top: 0; |
44 left: 0; | 41 left: 0; |
45 background-color: red; | 42 background-color: red; |
46 } | 43 } |
47 </style> | 44 </style> |
48 <script> | 45 <script> |
49 function doTest() | 46 function doTest() |
50 { | 47 { |
51 document.getElementById('overflow').scrollTop = 120; | 48 document.getElementById('overflow').scrollLeft = 100; |
52 } | 49 } |
53 window.addEventListener('load', doTest, false); | 50 window.addEventListener('load', doTest, false); |
54 </script> | 51 </script> |
55 </head> | 52 </head> |
56 <body> | 53 <body> |
57 This test checks that sticky positioned elements are contained by their enclosin
g ancestor with an overflow clip. | 54 This test checks that left offset is ignored with overconstrained sticky positio
ning and rtl text direction. |
58 There should be no red. | 55 There should be no red. |
59 <div id="overflow"> | 56 <div id="overflow"> |
60 <div class="spacer"></div> | 57 <div class="group" style="left: 400px"> |
61 <div class="group"> | 58 <div class="indicator box" style="left: 0;"></div> |
62 <div class="indicator box" style="top: 200px;"></div> | |
63 <div class="container"> | 59 <div class="container"> |
64 <div class="sticky box"></div> | 60 <div class="sticky box"></div> |
65 </div> | 61 </div> |
66 </div> | 62 </div> |
67 | 63 |
68 <div class="group" style="top: 100px"> | 64 <div class="group" style="left: 300px"> |
69 <div class="indicator box" style="top: 120px;"></div> | 65 <div class="indicator box" style="left: 100px;"></div> |
70 <div class="container"> | 66 <div class="container"> |
71 <div class="sticky box"></div> | 67 <div class="sticky box"></div> |
72 </div> | 68 </div> |
73 </div> | 69 </div> |
74 | 70 |
75 <div class="group" style="top: 240px"> | 71 <div class="group" style="left: 200px"> |
76 <div class="indicator box" style="top: 0;"></div> | 72 <div class="indicator box" style="left: 200px;"></div> |
77 <div class="container"> | 73 <div class="container"> |
78 <div class="sticky box"></div> | 74 <div class="sticky box"></div> |
79 </div> | 75 </div> |
80 </div> | 76 </div> |
81 </div> | 77 </div> |
82 </body> | 78 </body> |
83 </html> | 79 </html> |
OLD | NEW |