From c9caea826dbabd8bbb58dc53ea0636d7ad1cd7d6 Mon Sep 17 00:00:00 2001 From: Wang Kerui Date: Wed, 13 May 2015 17:02:22 +0800 Subject: [PATCH] support binding a.href by `way-href="data.a.href"` Usage: ``` ``` --- way.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/way.js b/way.js index f79fdde..88ee598 100644 --- a/way.js +++ b/way.js @@ -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) {