Permalink
Browse files

Merge pull request #20 from robashton/master

Other attributes removed when writing data into an attribute
  • Loading branch information...
2 parents 948a4e9 + 814c38c commit 24824865e1c20f697c41b84468ec5e3a5f829f19 Paolo Fragomeni committed Dec 12, 2011
View
@@ -97,7 +97,7 @@
// find the attribute key/value pair in the tag.
//
var att = matchedTag[0].match(
- new RegExp(map[key][1] + '\\s*=\\s*["|\'](.*)["|\']')
+ new RegExp(map[key][1] + '\\s*=\\s*["|\'](([^"\']*))["|\']')
);
if (map[key][1]) {
View
@@ -6,5 +6,8 @@ vows.describe('merge data into markup').addBatch({
'when providing both data and markup': {
'for simple template': common.createTest('simple'),
'for one level template': common.createTest('one-level'),
- }
+ 'for a data-bound template': common.createTest('data-bind', { "name": "data-bind" }),
+ 'for a different target attribute': common.createTest('attribute', { "url": ["data-bind", "src"]}),
+ 'for an different target attribute with extra values': common.createTest('extra-attribute', { "url": ["class", "src"]})
+ }
}).export(module);
@@ -0,0 +1 @@
+<img src="" data-bind="url"></img>
@@ -0,0 +1,3 @@
+{
+ "url": "http://example.com"
+}
@@ -0,0 +1 @@
+<img src="http://example.com" data-bind="url"></img>
@@ -1 +1 @@
-<div data-bind=name></div>
+<div data-bind="name"></div>
@@ -1 +1 @@
-<div data-bind=name>frank</div>
+<div data-bind="name">frank</div>
@@ -0,0 +1 @@
+<img src="" class="url extra"></img>
@@ -0,0 +1,3 @@
+{
+ "url": "http://example.com"
+}
@@ -0,0 +1 @@
+<img src="http://example.com" class="url extra"></img>

0 comments on commit 2482486

Please sign in to comment.