Skip to content

Commit

Permalink
Improved cross-browser compatibility. hasCLass() at 689 gets the 'cla…
Browse files Browse the repository at this point in the history
…ss' attribute but some browsers use 'className' instead. Added a check and failure branch to retrieve 'className' in case of failure.
  • Loading branch information
ryantanner committed Jan 25, 2012
1 parent 1a2b1f4 commit 7b3796c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,10 @@ h = {
},
hasClass: function(ele, classN) {
var classes = this.getAttribute(ele, 'class');
if (!classes) {
// getAttribute() on 'class' failed, browser uses className instead
var classes = this.getAttribute(ele, 'className');
}
return (classes.search(classN) > -1);
},
addClass: function(ele, classN) {
Expand Down

0 comments on commit 7b3796c

Please sign in to comment.