diff --git a/src/jqLite.js b/src/jqLite.js index 6b954005ffb3..af488abbe220 100644 --- a/src/jqLite.js +++ b/src/jqLite.js @@ -253,13 +253,7 @@ forEach({ }, attr: function(element, name, value){ - if (name === 'class') { - if(isDefined(value)) { - element.className = value; - } else { - return element.className; - } - } else if (SPECIAL_ATTR[name]) { + if (SPECIAL_ATTR[name]) { if (isDefined(value)) { element[name] = !!value; } else { diff --git a/test/directivesSpec.js b/test/directivesSpec.js index 2979cf752773..6dbbfe9d7c51 100644 --- a/test/directivesSpec.js +++ b/test/directivesSpec.js @@ -254,7 +254,7 @@ describe("directive", function() { scope.$digest(); scope.dynCls = 'foo'; scope.$digest(); - expect(element.attr('class')).toBe('ui-panel ui-selected ng-directive foo'); + expect(element[0].className).toBe('ui-panel ui-selected ng-directive foo'); }); @@ -262,7 +262,7 @@ describe("directive", function() { var scope = compile('
'); scope.dynCls = 'panel'; scope.$digest(); - expect(element.attr('class')).toBe('panel bar ng-directive'); + expect(element[0].className).toBe('panel bar ng-directive'); }); @@ -272,7 +272,7 @@ describe("directive", function() { scope.$digest(); scope.dynCls = 'window'; scope.$digest(); - expect(element.attr('class')).toBe('bar ng-directive window'); + expect(element[0].className).toBe('bar ng-directive window'); }); @@ -283,7 +283,7 @@ describe("directive", function() { element.addClass('foo'); scope.dynCls = ''; scope.$digest(); - expect(element.attr('class')).toBe('ng-directive'); + expect(element[0].className).toBe('ng-directive'); }); @@ -291,7 +291,7 @@ describe("directive", function() { var scope = compile('
'); scope.dynCls = [undefined, null]; scope.$digest(); - expect(element.attr('class')).toBe('ng-directive'); + expect(element[0].className).toBe('ng-directive'); }); }); diff --git a/test/jqLiteSpec.js b/test/jqLiteSpec.js index aac5aeb5ced0..ed929cb7616a 100644 --- a/test/jqLiteSpec.js +++ b/test/jqLiteSpec.js @@ -168,15 +168,6 @@ describe('jqLite', function(){ var elm = jqLite('
a
'); expect(elm.attr('non-existing')).toBeUndefined(); }); - - it('should special-case "class" attribute', function() { - // stupid IE9 returns null for element.getAttribute('class') when element has ng:class attr - var elm = jqLite('
a
'); - expect(elm.attr('class')).toBe(' any '); - - elm.attr('class', 'foo bar'); - expect(elm.attr('class')).toBe('foo bar'); - }); });