Skip to content

Commit

Permalink
support binding a.href by way-href="data.a.href"
Browse files Browse the repository at this point in the history
Usage: 
```
<a way-href="data.a.href" way-data="data.a.text"></a>
```
  • Loading branch information
Wang Kerui committed May 13, 2015
1 parent 1d1460f commit c9caea8
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions way.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,22 @@
w.dom(element).text(a);
}
},
// support binding a.href by `way-href="data.a.href"`
"A": function(a) {
if (options.href) {
var scope,key,val;
scope = way.dom(element).scope();
key = scope ? scope + '.' + options.href : options.href;
val = way.get(key);
w.dom(element).attr("href", val);
}

if (options.html) {
w.dom(element).html(a);
} else {
w.dom(element).text(a);
}
},
"IMG": function(a) {

if (!a) {
Expand Down

0 comments on commit c9caea8

Please sign in to comment.