From 3ea2416f8083a21bf2f47f3381a66bf97e7f59e2 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Tue, 19 Jul 2011 16:07:25 -0700 Subject: Revert "fix(ng:class): preserve classes added post compilation" This reverts commit 2428907259fa80ec3b1b4bfd85ea20028a9f4fa5. We decided to revert this because it is not bullet proof. The issue is that we can't reliably have both angular and non-angular code in charge of the DOM. We could work around some issues here and there, but we can't do it reliably, so it's better not to support DOM manipulation that happens outside of angular. There is a good chance that once we integrate with MDVs our possition will change, but until then our position is that only angular or angular widgets/directives can change change DOM that was compiled. --- test/directivesSpec.js | 41 +---------------------------------------- 1 file changed, 1 insertion(+), 40 deletions(-) (limited to 'test/directivesSpec.js') diff --git a/test/directivesSpec.js b/test/directivesSpec.js index 39c52ac6..bb530128 100644 --- a/test/directivesSpec.js +++ b/test/directivesSpec.js @@ -179,7 +179,7 @@ describe("directive", function(){ describe('ng:class', function() { - it('should change current class or remove old classes dynamically', function() { + it('should add new and remove old classes dynamically', function() { var scope = compile('
'); scope.dynClass = 'A'; scope.$eval(); @@ -206,45 +206,6 @@ describe("directive", function(){ expect(element.hasClass('A')).toBeTruthy(); expect(element.hasClass('B')).toBeTruthy(); }); - - it('should preserve class added post compilation', function() { - var scope = compile('
'); - scope.dynClass = 'A'; - scope.$eval(); - expect(element.hasClass('existing')).toBe(true); - - // add extra class, change model and eval - element.addClass('newClass'); - scope.dynClass = 'B'; - scope.$eval(); - - expect(element.hasClass('existing')).toBe(true); - expect(element.hasClass('B')).toBe(true); - expect(element.hasClass('newClass')).toBe(true); - }); - - it('should preserve class added post compilation even without existing classes"', function() { - var scope = compile('
'); - scope.dynClass = 'A'; - scope.$eval(); - expect(element.hasClass('A')).toBe(true); - - // add extra class, change model and eval - element.addClass('newClass'); - scope.dynClass = 'B'; - scope.$eval(); - - expect(element.hasClass('B')).toBe(true); - expect(element.hasClass('newClass')).toBe(true); - }); - - it('should preserve right classes"', function() { - var scope = compile('
'); - scope.dynCls = 'panel'; - scope.dynCls = 'foo'; - scope.$eval(); - expect(element.attr('class')).toBe('ui-panel ui-selected ng-directive foo'); - }); }); -- cgit v1.2.3