diff options
| author | Igor Minar | 2011-10-12 00:08:23 -0700 |
|---|---|---|
| committer | Igor Minar | 2011-10-12 23:04:47 -0700 |
| commit | 66fdb36ecbe0ec58ba3367a585b506e11ca1c8ad (patch) | |
| tree | c0c0f04476af3d3c551c2cbc4f39d429d0315c6c /src/directives.js | |
| parent | f0f5ffa9aa279cafc5db2c060102b653d6f728dd (diff) | |
| download | angular.js-66fdb36ecbe0ec58ba3367a585b506e11ca1c8ad.tar.bz2 | |
refactor(ng:bind-attr): simplify impl by leveraging jquery
Diffstat (limited to 'src/directives.js')
| -rw-r--r-- | src/directives.js | 13 |
1 files changed, 2 insertions, 11 deletions
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); } } }); |
