Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
brainfood
/
rivets
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
b0cb46e2
authored
2012-08-09 02:16:49 -0700
by
Michael Richards
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Implement a comment marker and use the original element as the reference.
1 parent
a91cc229
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
9 deletions
src/rivets.coffee
src/rivets.coffee
View file @
b0cb46e
...
...
@@ -48,7 +48,6 @@ class Rivets.Binding
@
routine
@
el
,
value
,
@
currentListener
@
currentListener
=
value
else
if
@
options
.
special
is
"iteration"
@
iterated
or=
[]
@
routine
@
el
,
value
,
@
else
value
=
value
()
if
value
instanceof
Function
...
...
@@ -192,21 +191,23 @@ eventBinding = (event) -> (el, bind, unbind) ->
# Returns an iteration binding routine for the specified collection.
iterationBinding
=
(
name
)
->
(
el
,
collection
,
binding
)
->
Rivets
.
routines
.
hide
el
,
true
for
iteration
in
binding
.
iterated
iteration
.
view
.
unbind
()
iteration
.
el
.
parentNode
.
removeChild
iteration
.
el
if
binding
.
iterated
?
for
iteration
in
binding
.
iterated
iteration
.
view
.
unbind
()
iteration
.
el
.
parentNode
.
removeChild
iteration
.
el
else
binding
.
marker
=
document
.
createComment
" rivets: each-
#{
name
}
"
el
.
parentNode
.
insertBefore
binding
.
marker
,
el
el
.
parentNode
.
removeChild
el
binding
.
iterated
=
[]
for
item
in
collection
data
=
{}
data
[
name
]
=
item
itemEl
=
el
.
cloneNode
true
Rivets
.
routines
.
show
itemEl
,
true
el
.
parentNode
.
insertBefore
itemEl
,
el
previous
=
binding
.
iterated
[
binding
.
iterated
.
length
-
1
]
or
binding
.
marker
binding
.
marker
.
parentNode
.
insertBefore
itemEl
,
previous
.
nextSibling
binding
.
iterated
.
push
el
:
itemEl
...
...
Please
register
or
sign in
to post a comment