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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/css/css-position-3/position-sticky-style-change.html

Issue 2907243002: Sticky position should be observable by getBoundingClientRect (Closed)
Patch Set: Use js test instead of ref test 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 behave correctly when style changes</tit le>
flackr 2017/05/31 21:10:23 same as below comment. "behave correctly" is a lit
yigu 2017/05/31 21:31:33 Done.
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 beh aves correctly when style changes." />
flackr 2017/05/31 21:10:23 Same
yigu 2017/05/31 21:31:33 Done.
5
6 <script src="/resources/testharness.js"></script>
7 <script src="/resources/testharnessreport.js"></script>
8
9 <style>
10 body {
11 margin: 0;
12 }
13
14 .container {
15 overflow: scroll;
16 width: 200px;
17 height: 200px;
18 }
19
20 .spacer {
21 height: 2000px;
22 }
23
24 .box {
25 width: 100px;
26 height: 100px;
27 background-color: green;
28 top: 50px;
29 }
30
31 .sticky {
32 position: sticky;
33 }
34 </style>
35
36 <div id="scroller" class="container">
37 <div id="sticky" class="sticky box"></div>
38 <div class="spacer"></div>
39 </div>
40
41 <script>
42 test(() => {
43 var element = document.getElementById('sticky');
44 assert_equals(element.getBoundingClientRect().top, 50);
45 document.getElementById('scroller').scrollTop = 100;
46 assert_equals(element.getBoundingClientRect().top, 50);
47 sticky.style.position = 'relative';
48 assert_equals(element.getBoundingClientRect().top, -50);
49 sticky.style.position = 'sticky';
50 assert_equals(element.getBoundingClientRect().top, 50);
51 }, 'sticky positioned element should behaves correctly upon style changes.');
flackr 2017/05/31 21:10:23 nit: title should exactly reflect the test. How ab
yigu 2017/05/31 21:31:33 Done.
52 </script>
53
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