Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 81b65bf

Browse files
committed
fix(ngStyle): skip setting empty value when new style has the property
Previously, all the properties in oldStyles are set to empty value once. Using AngularJS with jQuery 3.3.1, this disables the CSS transition as reported in jquery/jquery#4185.
1 parent 26ddc5f commit 81b65bf

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/ng/directive/ngStyle.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,11 @@
5454
var ngStyleDirective = ngDirective(function(scope, element, attr) {
5555
scope.$watchCollection(attr.ngStyle, function ngStyleWatchAction(newStyles, oldStyles) {
5656
if (oldStyles && (newStyles !== oldStyles)) {
57-
forEach(oldStyles, function(val, style) { element.css(style, '');});
57+
forEach(oldStyles, function(val, style) {
58+
if (!(newStyles && newStyles.hasOwnProperty(style))) {
59+
element.css(style, '');
60+
}
61+
});
5862
}
5963
if (newStyles) element.css(newStyles);
6064
});

0 commit comments

Comments
 (0)