Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /scroll-animations/scroll-timelines/scroll-timeline-source-single-axis-inner.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<meta charset="utf-8">
<title>ScrollTimeline source lookup with single-axis scroll containers (inner)</title>
<link rel="author" title="Free Debreuil" href="mailto:freedebreuil@google.com">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
.block-scroller,
.inline-scroller,
#subject {
width: 100px;
height: 100px;
}
.block-scroller {
overflow-block: scroll;
overflow-inline: clip;
}
.inline-scroller {
overflow-block: clip;
overflow-inline: scroll;
}
.vertical-writing-mode { writing-mode: vertical-rl; }
.horizontal-writing-mode { writing-mode: horizontal-tb; }
#subject {
animation: noop 1s;
animation-timeline: scroll(nearest inline);
}
@keyframes noop {}
</style>
<div id="outer" class="horizontal-writing-mode block-scroller">
<div id="inner" class="vertical-writing-mode inline-scroller">
<div id="subject" class="horizontal-writing-mode"></div>
</div>
</div>
<script>
test(() => {
const animations = subject.getAnimations();
assert_equals(animations.length, 1);
assert_equals(animations[0].timeline.source, inner);
}, 'ScrollTimeline selects the nearest matching ancestor scroll container');
</script>