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