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

fix(markup): Make special attrs such as ng:href work even without binding #539

Merged
merged 1 commit into from
Aug 26, 2011
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/markups.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 8 additions & 0 deletions test/markupSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,14 @@ describe("markups", function(){
expect(sortedHtml(element)).toEqual('<a ng:bind-attr="{"href":"{{url}}","rel":"{{rel}}"}"></a>');
});

it('should bind Text with no Bindings', function() {
forEach('src,href,checked,disabled,multiple,readonly,selected'.split(','), function(name) {
compile('<div ng:' + name +'="some"></div>');
expect(sortedHtml(element)).toEqual('<div ng:bind-attr="{"' + name +'":"some"}"></div>');
dealoc(element);
});
})

it('should Parse Text With No Bindings', function(){
var parts = parseBindings("a");
assertEquals(parts.length, 1);
Expand Down