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
68e23851
authored
2012-08-06 16:42:46 -0700
by
Michael Richards
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Build 0.3.1.
1 parent
feb9426d
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
13 deletions
lib/rivets.js
lib/rivets.min.js
package.json
src/rivets.coffee
lib/rivets.js
View file @
68e2385
// rivets.js
// version: 0.3.
0
// version: 0.3.
1
// author: Michael Richards
// license: MIT
(
function
()
{
...
...
@@ -51,7 +51,7 @@
formatter
=
_ref
[
_i
];
args
=
formatter
.
split
(
/
\s
+/
);
id
=
args
.
shift
();
value
=
this
.
model
[
id
]
instanceof
Function
?
(
_ref1
=
this
.
model
)[
id
].
apply
(
_ref1
,
[
value
].
concat
(
__slice
.
call
(
args
)))
:
Rivets
.
config
.
formatters
[
id
]
?
(
_ref2
=
Rivets
.
config
.
formatters
)[
id
].
apply
(
_ref2
,
[
value
].
concat
(
__slice
.
call
(
args
)))
:
void
0
;
value
=
this
.
model
[
id
]
instanceof
Function
?
(
_ref1
=
this
.
model
)[
id
].
apply
(
_ref1
,
[
value
].
concat
(
__slice
.
call
(
args
)))
:
Rivets
.
formatters
[
id
]
?
(
_ref2
=
Rivets
.
formatters
)[
id
].
apply
(
_ref2
,
[
value
].
concat
(
__slice
.
call
(
args
)))
:
void
0
;
}
return
value
;
};
...
...
@@ -158,7 +158,7 @@
bindingRegExp
=
this
.
bindingRegExp
();
eventRegExp
=
/^on-/
;
parseNode
=
function
(
node
)
{
var
attribute
,
context
,
ctx
,
dependencies
,
keypath
,
model
,
options
,
path
,
pipe
,
pipes
,
type
,
_i
,
_len
,
_ref
,
_results
;
var
attribute
,
context
,
ctx
,
dependencies
,
keypath
,
model
,
options
,
path
,
pipe
,
pipes
,
splitPath
,
type
,
_i
,
_len
,
_ref
,
_results
;
_ref
=
node
.
attributes
;
_results
=
[];
for
(
_i
=
0
,
_len
=
_ref
.
length
;
_i
<
_len
;
_i
++
)
{
...
...
@@ -186,11 +186,12 @@
}
return
_results1
;
})();
path
=
context
.
shift
().
split
(
/
(\.
|:
)
/
);
path
=
context
.
shift
();
splitPath
=
path
.
split
(
/
\.
|:/
);
options
.
formatters
=
pipes
;
model
=
_this
.
models
[
p
ath
.
shift
()];
options
.
bypass
=
path
.
shift
()
===
':'
;
keypath
=
p
ath
.
join
();
model
=
_this
.
models
[
splitP
ath
.
shift
()];
options
.
bypass
=
path
.
indexOf
(
":"
)
!==
-
1
;
keypath
=
splitP
ath
.
join
();
if
(
dependencies
=
context
.
shift
())
{
options
.
dependencies
=
dependencies
.
split
(
/
\s
+/
);
}
...
...
@@ -252,16 +253,18 @@
bindEvent
=
function
(
el
,
event
,
fn
)
{
if
(
window
.
addEventListener
)
{
return
el
.
addEventListener
(
event
,
fn
);
return
el
.
addEventListener
(
event
,
fn
,
false
);
}
else
{
event
=
"on"
+
event
;
return
el
.
attachEvent
(
event
,
fn
);
}
};
unbindEvent
=
function
(
el
,
event
,
fn
)
{
if
(
window
.
removeEventListener
)
{
return
el
.
removeEventListener
(
event
,
fn
);
return
el
.
removeEventListener
(
event
,
fn
,
false
);
}
else
{
event
=
"on"
+
event
;
return
el
.
detachEvent
(
event
,
fn
);
}
};
...
...
@@ -339,12 +342,14 @@
};
Rivets
.
config
=
{
preloadData
:
true
,
formatters
:
{}
preloadData
:
true
};
Rivets
.
formatters
=
{};
rivets
=
{
routines
:
Rivets
.
routines
,
formatters
:
Rivets
.
formatters
,
config
:
Rivets
.
config
,
configure
:
function
(
options
)
{
var
property
,
value
,
_results
;
...
...
lib/rivets.min.js
View file @
68e2385
This diff is collapsed.
Click to expand it.
package.json
View file @
68e2385
{
"name"
:
"rivets"
,
"description"
:
"Declarative data binding facility."
,
"version"
:
"0.3.
0
"
,
"version"
:
"0.3.
1
"
,
"author"
:
"Michael Richards"
,
"url"
:
"http://rivetsjs.com"
,
"main"
:
"./lib/rivets.js"
,
...
...
src/rivets.coffee
View file @
68e2385
# rivets.js
# version : 0.3.
0
# version : 0.3.
1
# author : Michael Richards
# license : MIT
...
...
Please
register
or
sign in
to post a comment