Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 1069494 of Animation.oncancel

  • Revision slug: Web/API/Animation/oncancel
  • Revision title: Animation.oncancel
  • Revision id: 1069494
  • Created:
  • Creator: PushpitaPikuDey
  • Is current revision? No
  • Comment

Revision Content

{{ SeeCompatTable() }}{{ APIRef("Web Animations API") }}

The Animation.oncancel property of the Web Animations API is the event handler for the cancel event.

The cancel event can be triggered manually with {{domxref("Animation.cancel()")}} or at an instance when the animation enters an idle play state from another state. (For instance, removing an animation before it has the chance to enter the finish play state.)

Note: Creating a new animation that is initially idle does not generate a new cancel event.

Syntax

// getting oncancel
var uponCancellation = animation.oncancel;

// setting oncancel
animation.oncancel = cancelAction;

Value

A function to be executed when the animation is cancelled or null.

Examples

If this animation is canceled, remove its element.

animation.oncancel = animation.effect.target.remove();

Specifications

Specification Status Comment
{{SpecName('Web Animations', '#dom-animation-oncancel', 'Animation.oncancel' )}} {{Spec2('Web Animations')}} Editor's draft.

Browser compatibility

{{CompatibilityTable}}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support {{CompatUnknown}} {{CompatGeckoDesktop(40)}} {{CompatNo}} {{CompatNo}} {{CompatNo}}
Feature Android Android Webview Chrome for Android Firefox Mobile (Gecko) Firefox OS IE Mobile Opera Mobile Safari Mobile
Basic support {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{ CompatUnknown}} {{CompatUnknown}} {{CompatNo}} {{CompatNo}} {{CompatNo}}

See also

Revision Source

<p>{{ SeeCompatTable() }}{{ APIRef("Web Animations API") }}</p>

<p>The <code><strong>Animation.oncancel</strong></code> property of the <a href="https://developer.mozilla.org/en-US/docs/Web/API/Web_Animations_API">Web Animations API</a> is the event handler for the <code>cancel</code> event.</p>

<p>The <code>cancel</code>&nbsp;event can be triggered manually with {{domxref("Animation.cancel()")}} or at an instance&nbsp;when the animation enters an idle play state from another state. (For instance, removing an animation before it has the chance to enter the&nbsp;<code>finish</code>&nbsp;play state.)</p>

<div class="note">
<p><strong>Note:</strong> Creating a new animation that is initially idle does not generate a new cancel event.</p>
</div>

<h2 id="Syntax">Syntax</h2>

<div class="syntaxbox">
<pre class="brush: js">
// getting oncancel
var uponCancellation = animation.oncancel;

// setting oncancel
animation.oncancel = cancelAction;</pre>
</div>

<h3 id="Value">Value</h3>

<p>A function to be executed when the animation is cancelled or <code>null.</code></p>

<h2 id="Examples">Examples</h2>

<p>If this animation is canceled, remove its element.</p>

<pre class="brush: js">
animation.oncancel = animation.effect.target.remove();
</pre>

<h2 id="Specifications">Specifications</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
  <tr>
   <td>{{SpecName('Web Animations', '#dom-animation-oncancel', 'Animation.oncancel' )}}</td>
   <td>{{Spec2('Web Animations')}}</td>
   <td>Editor's draft.</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility">Browser compatibility</h2>

<p>{{CompatibilityTable}}</p>

<div id="compat-desktop">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Chrome</th>
   <th>Firefox (Gecko)</th>
   <th>Internet Explorer</th>
   <th>Opera</th>
   <th>Safari (WebKit)</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatGeckoDesktop(40)}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
  </tr>
 </tbody>
</table>
</div>

<div id="compat-mobile">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Android</th>
   <th>Android Webview</th>
   <th>Chrome for Android</th>
   <th>Firefox Mobile (Gecko)</th>
   <th>Firefox OS</th>
   <th>IE Mobile</th>
   <th>Opera Mobile</th>
   <th>Safari Mobile</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{ CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
  </tr>
 </tbody>
</table>
</div>

<h2 id="See_also">See also</h2>

<ul>
 <li><a href="/en-US/docs/Web/API/Web_Animations_API">Web Animations API</a></li>
 <li>{{domxref("Animation")}}</li>
</ul>
Revert to this revision