diff options
| author | Vojta Jina | 2013-10-09 13:51:59 -0700 | 
|---|---|---|
| committer | Vojta Jina | 2013-10-09 15:19:10 -0700 | 
| commit | 64fd2c421ed582c16812d164a8a6f031b8e66287 (patch) | |
| tree | 5b9ff25462dd4d6575b90e28288c0d14f2053b75 /test/jqLiteSpec.js | |
| parent | b6a37d112b3e1478f4d14a5f82faabf700443748 (diff) | |
| download | angular.js-64fd2c421ed582c16812d164a8a6f031b8e66287.tar.bz2 | |
fix(jqLite): ignore class methods on comment elements
Since c785267e jqLite uses setAttribute (rather than className property) in order to change classes. Some elements (eg. Comment) do not have this method which blows up.
jQuery silently ignores these method calls (because it uses className), so to get the same behavior as jQuery, we check for setAttribute method first.
Diffstat (limited to 'test/jqLiteSpec.js')
| -rw-r--r-- | test/jqLiteSpec.js | 10 | 
1 files changed, 10 insertions, 0 deletions
| diff --git a/test/jqLiteSpec.js b/test/jqLiteSpec.js index de9c74da..24920273 100644 --- a/test/jqLiteSpec.js +++ b/test/jqLiteSpec.js @@ -493,6 +493,16 @@ describe('jqLite', function() {      }); +    it('should ignore comment elements', function() { +      var comment = jqLite(document.createComment('something')); + +      comment.addClass('whatever'); +      comment.hasClass('whatever'); +      comment.toggleClass('whatever'); +      comment.removeClass('whatever'); +    }); + +      describe('hasClass', function() {        it('should check class', function() {          var selector = jqLite([a, b]); | 
