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
8c37555a
authored
2012-08-13 00:55:34 -0700
by
Michael Richards
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Build 0.3.3.
1 parent
07983619
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
5 deletions
lib/rivets.js
lib/rivets.min.js
package.json
src/rivets.coffee
lib/rivets.js
View file @
8c37555
// rivets.js
// version: 0.3.
2
// version: 0.3.
3
// author: Michael Richards
// license: MIT
(
function
()
{
var
Rivets
,
attributeBinding
,
bindEvent
,
eventBinding
,
getInputValue
,
iterationBinding
,
rivets
,
unbindEvent
,
var
Rivets
,
attributeBinding
,
bindEvent
,
classBinding
,
eventBinding
,
getInputValue
,
iterationBinding
,
rivets
,
unbindEvent
,
__bind
=
function
(
fn
,
me
){
return
function
(){
return
fn
.
apply
(
me
,
arguments
);
};
},
__slice
=
[].
slice
,
__indexOf
=
[].
indexOf
||
function
(
item
)
{
for
(
var
i
=
0
,
l
=
this
.
length
;
i
<
l
;
i
++
)
{
if
(
i
in
this
&&
this
[
i
]
===
item
)
return
i
;
}
return
-
1
;
};
...
...
@@ -38,6 +38,8 @@
switch
(
this
.
options
.
special
)
{
case
"event"
:
return
eventBinding
(
this
.
type
);
case
"class"
:
return
classBinding
(
this
.
type
);
case
"iteration"
:
return
iterationBinding
(
this
.
type
);
default
:
...
...
@@ -161,13 +163,14 @@
};
View
.
prototype
.
build
=
function
()
{
var
bindingRegExp
,
el
,
eventRegExp
,
iterationRegExp
,
iterator
,
node
,
parseNode
,
skipNodes
,
_i
,
_len
,
_ref
,
_results
,
var
bindingRegExp
,
classRegExp
,
el
,
eventRegExp
,
iterationRegExp
,
iterator
,
node
,
parseNode
,
skipNodes
,
_i
,
_len
,
_ref
,
_results
,
_this
=
this
;
this
.
bindings
=
[];
skipNodes
=
[];
iterator
=
null
;
bindingRegExp
=
this
.
bindingRegExp
();
eventRegExp
=
/^on-/
;
classRegExp
=
/^class-/
;
iterationRegExp
=
/^each-/
;
parseNode
=
function
(
node
)
{
var
a
,
attribute
,
binding
,
context
,
ctx
,
dependencies
,
keypath
,
model
,
n
,
options
,
path
,
pipe
,
pipes
,
splitPath
,
type
,
_i
,
_j
,
_k
,
_l
,
_len
,
_len1
,
_len2
,
_len3
,
_ref
,
_ref1
,
_ref2
,
_results
;
...
...
@@ -230,6 +233,10 @@
type
=
type
.
replace
(
eventRegExp
,
''
);
options
.
special
=
"event"
;
}
if
(
classRegExp
.
test
(
type
))
{
type
=
type
.
replace
(
classRegExp
,
''
);
options
.
special
=
"class"
;
}
if
(
iterationRegExp
.
test
(
type
))
{
type
=
type
.
replace
(
iterationRegExp
,
''
);
options
.
special
=
"iteration"
;
...
...
@@ -335,6 +342,17 @@
};
};
classBinding
=
function
(
name
)
{
return
function
(
el
,
value
)
{
var
elClass
,
hasClass
;
elClass
=
" "
+
el
.
className
+
" "
;
hasClass
=
elClass
.
indexOf
(
" "
+
name
+
" "
)
!==
-
1
;
if
(
!
value
===
hasClass
)
{
return
el
.
className
=
value
?
""
+
el
.
className
+
" "
+
name
:
elClass
.
replace
(
" "
+
name
+
" "
,
" "
).
trim
();
}
};
};
iterationBinding
=
function
(
name
)
{
return
function
(
el
,
collection
,
binding
)
{
var
data
,
item
,
itemEl
,
iteration
,
m
,
n
,
previous
,
_i
,
_j
,
_len
,
_len1
,
_ref
,
_ref1
,
_results
;
...
...
lib/rivets.min.js
View file @
8c37555
This diff is collapsed.
Click to expand it.
package.json
View file @
8c37555
{
"name"
:
"rivets"
,
"description"
:
"Declarative data binding facility."
,
"version"
:
"0.3.
2
"
,
"version"
:
"0.3.
3
"
,
"author"
:
"Michael Richards"
,
"url"
:
"http://rivetsjs.com"
,
"main"
:
"./lib/rivets.js"
,
...
...
src/rivets.coffee
View file @
8c37555
# rivets.js
# version : 0.3.
2
# version : 0.3.
3
# author : Michael Richards
# license : MIT
...
...
Please
register
or
sign in
to post a comment