From 5927b23ef35736ec075e226c32d46decb5d42e34 Mon Sep 17 00:00:00 2001 From: Di Peng Date: Thu, 25 Aug 2011 16:31:00 -0700 Subject: [PATCH] fix(markup): Make special attrs such as ng:href work even without binding - special attrs such as ng:href, ng:check did not work as intended when their values do not contain bindings. And this commit is to fix that Closes #534 --- src/markups.js | 2 +- test/markupSpec.js | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/markups.js b/src/markups.js index 955b98445b41..3144bbb05dcb 100644 --- a/src/markups.js +++ b/src/markups.js @@ -418,7 +418,7 @@ angularAttrMarkup('{{}}', function(value, name, element){ value = decodeURI(value); var bindings = parseBindings(value), bindAttr; - if (hasBindings(bindings)) { + if (hasBindings(bindings) || SPECIAL_ATTRS[name]) { element.removeAttr(name); bindAttr = fromJson(element.attr(NG_BIND_ATTR) || "{}"); bindAttr[SPECIAL_ATTRS[name] || name] = value; diff --git a/test/markupSpec.js b/test/markupSpec.js index 36861e174fa2..ea786395673f 100644 --- a/test/markupSpec.js +++ b/test/markupSpec.js @@ -154,6 +154,14 @@ describe("markups", function(){ expect(sortedHtml(element)).toEqual(''); }); + it('should bind Text with no Bindings', function() { + forEach('src,href,checked,disabled,multiple,readonly,selected'.split(','), function(name) { + compile('
'); + expect(sortedHtml(element)).toEqual('
'); + dealoc(element); + }); + }) + it('should Parse Text With No Bindings', function(){ var parts = parseBindings("a"); assertEquals(parts.length, 1);