From 66fdb36ecbe0ec58ba3367a585b506e11ca1c8ad Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Wed, 12 Oct 2011 00:08:23 -0700 Subject: refactor(ng:bind-attr): simplify impl by leveraging jquery --- src/directives.js | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'src/directives.js') diff --git a/src/directives.js b/src/directives.js index e5cb9044..5cafab47 100644 --- a/src/directives.js +++ b/src/directives.js @@ -429,19 +429,10 @@ angularDirective("ng:bind-attr", function(expression){ this.$watch(function(scope){ var values = scope.$eval(expression); for(var key in values) { - var value = compileBindTemplate(values[key])(scope, element), - specialName = BOOLEAN_ATTR[lowercase(key)]; + var value = compileBindTemplate(values[key])(scope, element); if (lastValue[key] !== value) { lastValue[key] = value; - if (specialName) { - if (toBoolean(value)) { - element.attr(specialName, specialName); - } else { - element.removeAttr(specialName); - } - } else { - element.attr(key, value); - } + element.attr(key, BOOLEAN_ATTR[lowercase(key)] ? toBoolean(value) : value); } } }); -- cgit v1.2.3