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

fix(ngAnimate): support removing classes from SVG elements when using jQuery #8893

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/AngularPublic.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ function publishExternalAPI(angular){
'getTestability': getTestability,
'$$minErr': minErr,
'$$csp': csp,
'reloadWithDebugInfo': reloadWithDebugInfo
'reloadWithDebugInfo': reloadWithDebugInfo,
'$$hasClass': jqLiteHasClass
});

angularModule = setupModuleLoader(window);
Expand Down
2 changes: 1 addition & 1 deletion src/ngAnimate/animate.js
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ angular.module('ngAnimate', ['ng'])

var toAdd = [], toRemove = [];
forEach(map, function(status, className) {
var hasClass = element.hasClass(className);
var hasClass = angular.$$hasClass(element[0], className);
var matchingAnimation = lookup[className] || {};

// When addClass and removeClass is called then $animate will check to
Expand Down
12 changes: 12 additions & 0 deletions test/ngAnimate/animateSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4641,6 +4641,18 @@ describe("ngAnimate", function() {
expect(child.hasClass('ng-enter')).toBe(false);
expect(child.hasClass('ng-enter-active')).toBe(false);
}));


it('should properly remove classes from SVG elements', inject(function($animate, $rootScope) {
var element = jqLite('<svg width="500" height="500"><rect class="class-of-doom"></rect></svg>');
var child = element.find('rect');
$animate.removeClass(child, 'class-of-doom');

$rootScope.$digest();
expect(child.attr('class')).toBe('');

dealoc(element);
}));
});
});
});