Skip to content

Commit 11d19c6

Browse files
committed
[css-animations-2] Add definition of owning element
1 parent 8b9208e commit 11d19c6

2 files changed

Lines changed: 187 additions & 242 deletions

File tree

css-animations-2/Overview.bs

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ Editor: L. David Baron, Mozilla, dbaron@dbaron.org
1212
1313
Abstract: This CSS module describes a way for authors to animate the values of CSS properties over time, using keyframes. The behavior of these keyframe animations can be controlled by specifying their duration, number of repeats, and repeating behavior.
1414
</pre>
15+
<pre class="anchors">
16+
urlPrefix: https://w3c.github.io/web-animations/; type: dfn; spec: web-animations
17+
text: target element
18+
text: target effect
19+
</pre>
1520

1621
<h2 id="delta">Delta specification</h2>
1722

@@ -20,6 +25,57 @@ only the differences from CSS Animations Level 1 [[!CSS3-ANIMATIONS]].
2025
Once the Level 1 specification is closer to complete, it will be merged
2126
with the additions here into a complete level 2 specification.</p>
2227

28+
# Animations # {#animations}
29+
30+
## Owning element ## {#owning-element-section}
31+
32+
The <dfn>owning element</dfn> of a CSS Animation refers to the element or
33+
pseudo-element to which the 'animation-name' property was applied that generated
34+
the animation.
35+
36+
If an animation was generated directly by script then it has no <a>owning
37+
element</a>.
38+
39+
If an animation generated using the markup defined in this specification is
40+
later disassociated from that markup by an update to the computed value of the
41+
'animation-name' property on the <a>owning element</a>, the animation is
42+
disassociated from its <a>owning element</a> (that is, it has no <a>owning
43+
element</a> from that point forwards).
44+
45+
<div class="note">
46+
47+
In the example below, <code>animation</code>'s initial <a>owning element</a>
48+
is <code>elem</code>. <code>animation</code> is disassociated from
49+
<code>element</code> through an update to the computed value of
50+
<code>elem</code>'s 'animation-name' property.
51+
52+
<pre class="example lang-javascript">
53+
elem.style.animation = 'spin 1s';
54+
let animation = elem.getAnimations()[0]; // animation's owning element is elem
55+
elem.style.animation = ''; // animation no longer has an owning element
56+
</pre>
57+
58+
Note that although the <a>owning element</a> is often equal to the <a>target
59+
element</a> of an animation's <a>target effect</a>, this is not always the case.
60+
The following example demonstrates some of the situations where these two
61+
elements may differ.
62+
63+
<pre class="example lang-javascript">
64+
elem.style.animation = 'move 1s';
65+
let animation = elem.getAnimations()[0];
66+
// animation.effect.target == elem == animation's owning element
67+
68+
let mutableEffect = animation.effect.clone();
69+
animation.effect = mutableEffect;
70+
animation.effect.target = elem2;
71+
// animation.effect.target == elem2 != animation's owning element
72+
73+
animation.effect = null;
74+
// animation.effect.target is undefined != animation's owning element
75+
</pre>
76+
77+
</div>
78+
2379
<h2 id="events">Animation Events</h2>
2480
2581
<h3 id="event-animationevent">Types of <code>AnimationEvent</code></h3>

0 commit comments

Comments
 (0)