transition-native.js revision 100cd7da99ccec416d3021e9a567addc2d9ed3df
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein* The Native Transition Utility provides an API wrapper for CSS transitions.
4a14ce5ba00ab7bc55c99ffdcf59c7a4ab902721Automatic Updater* It is also the base module for the timer-based transition module.
4610465ed9408cbe434dbfb8be8ea53f48969c91Bob Halley* @module transition
8a66318e41ed14c5a88130e8c362610e8faa2121Mark Andrews* Provides the base Transition class. The "transition" method is added to Node,
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein* and is how Transition should be used.
8a66318e41ed14c5a88130e8c362610e8faa2121Mark Andrews* @module transition
8a66318e41ed14c5a88130e8c362610e8faa2121Mark Andrews* @submodule transition-native
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein * A class for constructing transition instances.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein * Adds the "transition" method to Node.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein * @class Transition
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein * @constructor
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein TRANSITION_PROPERTY = '-webkit-transition-property',
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein TRANSITION_DURATION = '-webkit-transition-duration',
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein TRANSITION_TIMING_FUNCTION = '-webkit-transition-timing-function',
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein property = property.replace(/-([a-z])/gi, function(m0, m1) {
c247e3f281613fabe1af362e9f3157e35ebbe52cMark Andrews property = property.replace(/([A-Z]?)([a-z]+)([A-Z]?)/g, function(m0, m1, m2, m3) {
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob AusteinTransition._reKeywords = /^(?:node|duration|iterations|easing|delay)$/;
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinif (TRANSITION in Y.config.doc.documentElement.style) {
1224c3b69b3d18f7127aa042644936af25a2d679Mark Andrews config.duration: anim.constructor.DEFAULT_DURATION;
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein anim._easing = config.easing || anim.constructor.DEFAULT_EASING;
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein anim._count = 0; // track number of animated properties
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein // might just be a value
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein // take control if another transition owns this property
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein if (attr && attr.transition && attr.transition !== anim) {
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein attr.transition._count--; // remapping attr to this transition
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein duration: ((typeof config.duration !== 'undefined') ? config.duration :
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein anim._duration) || 0.0001, // make 0 async and fire events
1224c3b69b3d18f7127aa042644936af25a2d679Mark Andrews delay: (typeof config.delay !== 'undefined') ? config.delay :
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein attrs = Transition._nodeAttrs[Y.stamp(anim._node)];
var anim = this,
attr;
var anim = this;
return anim;
_start: function() {
this._runNative();
var anim = this,
attr,
name;
var anim = this,
data = {
if (callback) {
_onNativeEnd: function(e) {
var node = this,
if (anim) {
destroy: function() {
this.detachAll();
this._node = null;