Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 66fdb36

Browse files
committed
refactor(ng:bind-attr): simplify impl by leveraging jquery
1 parent f0f5ffa commit 66fdb36

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

src/directives.js

+2-11
Original file line numberDiff line numberDiff line change
@@ -429,19 +429,10 @@ angularDirective("ng:bind-attr", function(expression){
429429
this.$watch(function(scope){
430430
var values = scope.$eval(expression);
431431
for(var key in values) {
432-
var value = compileBindTemplate(values[key])(scope, element),
433-
specialName = BOOLEAN_ATTR[lowercase(key)];
432+
var value = compileBindTemplate(values[key])(scope, element);
434433
if (lastValue[key] !== value) {
435434
lastValue[key] = value;
436-
if (specialName) {
437-
if (toBoolean(value)) {
438-
element.attr(specialName, specialName);
439-
} else {
440-
element.removeAttr(specialName);
441-
}
442-
} else {
443-
element.attr(key, value);
444-
}
435+
element.attr(key, BOOLEAN_ATTR[lowercase(key)] ? toBoolean(value) : value);
445436
}
446437
}
447438
});

0 commit comments

Comments
 (0)