perf(ngClass): improve even-odd checking

This now uses the same technique as ngRepeat.
This commit is contained in:
marija
2016-02-05 15:51:27 +01:00
committed by Martin Staffa
parent 4fed5d873c
commit 4ae4cc9d46
+3 -1
View File
@@ -69,7 +69,9 @@ function classDirective(name, selector) {
}
function ngClassWatchAction(newVal) {
if (selector === true || scope.$index % 2 === selector) {
// jshint bitwise: false
if (selector === true || (scope.$index & 1) === selector) {
// jshint bitwise: true
var newClasses = arrayClasses(newVal || []);
if (!oldVal) {
addClasses(newClasses);