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