Build 0.4.5.
Showing
5 changed files
with
11 additions
and
5 deletions
... | @@ -2,7 +2,7 @@ | ... | @@ -2,7 +2,7 @@ |
2 | "name": "rivets", | 2 | "name": "rivets", |
3 | "repo": "mikeric/rivets", | 3 | "repo": "mikeric/rivets", |
4 | "description": "Declarative data binding facility.", | 4 | "description": "Declarative data binding facility.", |
5 | "version": "0.4.4", | 5 | "version": "0.4.5", |
6 | "keywords": ["data binding", "template"], | 6 | "keywords": ["data binding", "template"], |
7 | "scripts": ["lib/rivets.js"], | 7 | "scripts": ["lib/rivets.js"], |
8 | "main": "lib/rivets.js", | 8 | "main": "lib/rivets.js", | ... | ... |
1 | // rivets.js | 1 | // rivets.js |
2 | // version: 0.4.4 | 2 | // version: 0.4.5 |
3 | // author: Michael Richards | 3 | // author: Michael Richards |
4 | // license: MIT | 4 | // license: MIT |
5 | (function() { | 5 | (function() { |
... | @@ -535,6 +535,7 @@ | ... | @@ -535,6 +535,7 @@ |
535 | el.parentNode.removeChild(el); | 535 | el.parentNode.removeChild(el); |
536 | } | 536 | } |
537 | this.iterated = []; | 537 | this.iterated = []; |
538 | if (collection) { | ||
538 | _results = []; | 539 | _results = []; |
539 | for (_k = 0, _len2 = collection.length; _k < _len2; _k++) { | 540 | for (_k = 0, _len2 = collection.length; _k < _len2; _k++) { |
540 | item = collection[_k]; | 541 | item = collection[_k]; |
... | @@ -546,12 +547,17 @@ | ... | @@ -546,12 +547,17 @@ |
546 | } | 547 | } |
547 | data[this.args[0]] = item; | 548 | data[this.args[0]] = item; |
548 | itemEl = el.cloneNode(true); | 549 | itemEl = el.cloneNode(true); |
549 | previous = this.iterated[this.iterated.length - 1] || this.marker; | 550 | if (this.iterated.length > 0) { |
551 | previous = this.iterated[this.iterated.length - 1].els[0]; | ||
552 | } else { | ||
553 | previous = this.marker; | ||
554 | } | ||
550 | this.marker.parentNode.insertBefore(itemEl, (_ref3 = previous.nextSibling) != null ? _ref3 : null); | 555 | this.marker.parentNode.insertBefore(itemEl, (_ref3 = previous.nextSibling) != null ? _ref3 : null); |
551 | _results.push(this.iterated.push(rivets.bind(itemEl, data))); | 556 | _results.push(this.iterated.push(rivets.bind(itemEl, data))); |
552 | } | 557 | } |
553 | return _results; | 558 | return _results; |
554 | } | 559 | } |
560 | } | ||
555 | }, | 561 | }, |
556 | "class-*": function(el, value) { | 562 | "class-*": function(el, value) { |
557 | var elClass; | 563 | var elClass; | ... | ... |
This diff is collapsed.
Click to expand it.
1 | { | 1 | { |
2 | "name" : "rivets", | 2 | "name" : "rivets", |
3 | "description" : "Declarative data binding facility.", | 3 | "description" : "Declarative data binding facility.", |
4 | "version" : "0.4.4", | 4 | "version" : "0.4.5", |
5 | "author" : "Michael Richards", | 5 | "author" : "Michael Richards", |
6 | "url" : "http://rivetsjs.com", | 6 | "url" : "http://rivetsjs.com", |
7 | "main" : "./lib/rivets.js", | 7 | "main" : "./lib/rivets.js", | ... | ... |
-
Please register or sign in to post a comment