mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 21:29:06 +00:00
LibWeb: Support subtree option in Animatable.getAnimations()
This commit is contained in:
parent
e2cb25e35c
commit
a80af938eb
Notes:
sideshowbarker
2024-07-17 11:30:05 +09:00
Author: https://github.com/mattco98
Commit: a80af938eb
Pull-request: https://github.com/SerenityOS/serenity/pull/24514
3 changed files with 41 additions and 4 deletions
26
Tests/LibWeb/Text/input/WebAnimations/misc/animatable.html
Normal file
26
Tests/LibWeb/Text/input/WebAnimations/misc/animatable.html
Normal file
|
@ -0,0 +1,26 @@
|
|||
<!DOCTYPE html>
|
||||
<div id="parent">
|
||||
<div id="child1"></div>
|
||||
<div id="child2">
|
||||
<div id="child3"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="../../include.js"></script>
|
||||
<script>
|
||||
test(() => {
|
||||
const elements = ["parent", "child1", "child2", "child3"];
|
||||
for (const id of elements)
|
||||
document.getElementById(id).animate({}, { duration: Infinity });
|
||||
|
||||
const parent = document.getElementById("parent");
|
||||
const subtreeAnimations = parent.getAnimations({ subtree: true });
|
||||
println(`num animations without subtree: ${parent.getAnimations({ subtree: false }).length}`);
|
||||
println(`num animations with subtree: ${subtreeAnimations.length}`);
|
||||
|
||||
for (let i = 0; i < elements.length; i++) {
|
||||
const elem = document.getElementById(elements[i]);
|
||||
const correctOrder = Object.is(subtreeAnimations[i], elem.getAnimations()[0]);
|
||||
println(`Anim for element ${elements[i]} is in the correct order: ${correctOrder}`);
|
||||
}
|
||||
})
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue