(element, classes)
| 4610 | } |
| 4611 | |
| 4612 | function resolveElementClasses(element, classes) { |
| 4613 | var toAdd = [], toRemove = []; |
| 4614 | |
| 4615 | var hasClasses = createMap(); |
| 4616 | forEach((element.attr('class') || '').split(/\s+/), function(className) { |
| 4617 | hasClasses[className] = true; |
| 4618 | }); |
| 4619 | |
| 4620 | forEach(classes, function(status, className) { |
| 4621 | var hasClass = hasClasses[className]; |
| 4622 | |
| 4623 | // If the most recent class manipulation (via $animate) was to remove the class, and the |
| 4624 | // element currently has the class, the class is scheduled for removal. Otherwise, if |
| 4625 | // the most recent class manipulation (via $animate) was to add the class, and the |
| 4626 | // element does not currently have the class, the class is scheduled to be added. |
| 4627 | if (status === false && hasClass) { |
| 4628 | toRemove.push(className); |
| 4629 | } else if (status === true && !hasClass) { |
| 4630 | toAdd.push(className); |
| 4631 | } |
| 4632 | }); |
| 4633 | |
| 4634 | return (toAdd.length + toRemove.length) > 0 && |
| 4635 | [toAdd.length ? toAdd : null, toRemove.length ? toRemove : null]; |
| 4636 | } |
| 4637 | |
| 4638 | function cachedClassManipulation(cache, classes, op) { |
| 4639 | for (var i=0, ii = classes.length; i < ii; ++i) { |
no test coverage detected