|
|
@@ -9,6 +9,8 @@ var config = require('./config'),
|
|
|
*/
|
|
|
module.exports = function (el, stage, changeState, init) {
|
|
|
|
|
|
+ // TODO: directly return if IE9
|
|
|
+
|
|
|
var className = el.sd_transition
|
|
|
|
|
|
// in sd-repeat, the sd-transition directive
|
|
|
@@ -18,9 +20,12 @@ module.exports = function (el, stage, changeState, init) {
|
|
|
}
|
|
|
|
|
|
// TODO: optional duration which
|
|
|
- // can override the default transitionend event
|
|
|
+ // can override the default transitionend event
|
|
|
|
|
|
- // if no transition, just
|
|
|
+ // if no transition, just call changeState sync.
|
|
|
+ // this is internal API and the changeState callback
|
|
|
+ // will always contain only dom manipulations that
|
|
|
+ // doesn't care about the sync/async-ness of this method.
|
|
|
if (init || !className) {
|
|
|
return changeState()
|
|
|
}
|
|
|
@@ -28,14 +33,18 @@ module.exports = function (el, stage, changeState, init) {
|
|
|
var cl = el.classList
|
|
|
|
|
|
if (stage > 0) { // enter
|
|
|
+
|
|
|
cl.add(className)
|
|
|
changeState()
|
|
|
setTimeout(function () {
|
|
|
cl.remove(className)
|
|
|
}, 0)
|
|
|
+
|
|
|
} else { // leave
|
|
|
+
|
|
|
cl.add(className)
|
|
|
el.addEventListener(endEvent, onEnd)
|
|
|
+
|
|
|
}
|
|
|
|
|
|
function onEnd () {
|