jquery.transitions
jquery.transitions copied to clipboard
style attribute cleared after transition
If you have a tag having a non-empty style attribute the style attribute will be empty after transition.
Right now addTransitionClass() and addTransitionClass() behave like this: before: <div style="color:blue; font-weight:bold;">...</div> transition after: <div style="">...</div>
Expected behaviour: before: <div style="color:blue; font-weight:bold;">...</div> transition after: <div style="color:blue; font-weight:bold;">...</div>
For me the following patch did it (includes test case as well):
diff --git a/jquery.transitions.js b/jquery.transitions.js
index b6f3e9c..ae08973 100644
--- a/jquery.transitions.js
+++ b/jquery.transitions.js
@@ -232,7 +232,7 @@
elem
.unbind(jQuery.support.cssTransitionEnd, end)
- .bind(jQuery.support.cssTransitionEnd, { obj: elem, callback: options && options.callback, properties: properties }, end);
+ .bind(jQuery.support.cssTransitionEnd, { obj: elem, style: style, callback: options && options.callback, properties: properties }, end
}
// Check to see if children have transitions. This is just a
// sanity check. It is not foolproof, because nodes could have
diff --git a/test/index.html b/test/index.html
index 4a9e2f8..13f217f 100644
--- a/test/index.html
+++ b/test/index.html
@@ -231,6 +231,12 @@
</div>
</section>
+ <h2>transition with style attribute set</h2>
+ <section class="no2_test test">
+ <p>Click me.</p>
+ <div class="expand" style="color:blue; font-weight:bold;">text should be bold and blue!</div>
+ </section>
+
<h2>No transition</h2>
<section class="test">
Regards, Jan