Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/css/css-position-3/position-sticky-get-bounding-client-rect.html

Issue 2907243002: Sticky position should be observable by getBoundingClientRect (Closed)
Patch Set: nit Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <title>Sticky positioned element should be observable by getBoundingClientRect.< /title>
3 <link rel="help" href="https://www.w3.org/TR/css-position-3/#sticky-pos" />
4 <meta name="assert" content="This test checks that sticky positioned element
5 should be observable by getBoundingClientRect." />
6
7 <script src="/resources/testharness.js"></script>
8 <script src="/resources/testharnessreport.js"></script>
9
10 <style>
11 body {
12 margin: 0;
13 }
14
15 .container {
16 overflow: scroll;
17 width: 200px;
18 height: 200px;
19 }
20
21 .spacer {
22 height: 2000px;
23 }
24
25 .box {
26 width: 100px;
27 height: 100px;
28 background-color: green;
29 top: 50px;
30 }
31
32 .sticky {
33 position: sticky;
34 }
35 </style>
36
37 <div id="scroller" class="container">
38 <div id="sticky" class="sticky box"></div>
39 <div class="spacer"></div>
40 </div>
41
42 <script>
43 test(() => {
44 var element = document.getElementById('sticky');
45 assert_equals(element.getBoundingClientRect().top, 50);
46 document.getElementById('scroller').scrollTop = 100;
47 assert_equals(element.getBoundingClientRect().top, 50);
48 sticky.style.position = 'relative';
49 assert_equals(element.getBoundingClientRect().top, -50);
50 sticky.style.position = 'sticky';
51 assert_equals(element.getBoundingClientRect().top, 50);
52 }, 'sticky positioned element should be observable by getBoundingClientRect.');
53 </script>
54
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698