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
0d59fe30
authored
2012-09-05 19:06:00 -0700
by
Michael Richards
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Build 0.3.8.
1 parent
38550126
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
18 deletions
lib/rivets.js
lib/rivets.min.js
package.json
src/rivets.coffee
lib/rivets.js
View file @
0d59fe3
// rivets.js
// version: 0.3.
7
// version: 0.3.
8
// author: Michael Richards
// license: MIT
(
function
()
{
...
...
@@ -12,7 +12,7 @@
if
(
!
String
.
prototype
.
trim
)
{
String
.
prototype
.
trim
=
function
()
{
return
this
.
replace
(
/^
\s
+|
\s
+$/g
,
""
);
return
this
.
replace
(
/^
\s
+|
\s
+$/g
,
''
);
};
}
...
...
@@ -40,11 +40,11 @@
this
.
routine
=
(
function
()
{
switch
(
this
.
options
.
special
)
{
case
"event"
:
case
'event'
:
return
eventBinding
(
this
.
type
);
case
"class"
:
case
'class'
:
return
classBinding
(
this
.
type
);
case
"iteration"
:
case
'iteration'
:
return
iterationBinding
(
this
.
type
);
default
:
return
Rivets
.
routines
[
this
.
type
]
||
attributeBinding
(
this
.
type
);
...
...
@@ -71,11 +71,11 @@
};
Binding
.
prototype
.
set
=
function
(
value
)
{
value
=
value
instanceof
Function
&&
this
.
options
.
special
!==
"event"
?
this
.
formattedValue
(
value
.
call
(
this
.
model
))
:
this
.
formattedValue
(
value
);
if
(
this
.
options
.
special
===
"event"
)
{
value
=
value
instanceof
Function
&&
this
.
options
.
special
!==
'event'
?
this
.
formattedValue
(
value
.
call
(
this
.
model
))
:
this
.
formattedValue
(
value
);
if
(
this
.
options
.
special
===
'event'
)
{
this
.
routine
(
this
.
el
,
value
,
this
.
currentListener
);
return
this
.
currentListener
=
value
;
}
else
if
(
this
.
options
.
special
===
"iteration"
)
{
}
else
if
(
this
.
options
.
special
===
'iteration'
)
{
return
this
.
routine
(
this
.
el
,
value
,
this
);
}
else
{
return
this
.
routine
(
this
.
el
,
value
);
...
...
@@ -236,23 +236,23 @@
splitPath
=
path
.
split
(
/
\.
|:/
);
options
.
formatters
=
pipes
;
model
=
_this
.
models
[
splitPath
.
shift
()];
options
.
bypass
=
path
.
indexOf
(
":"
)
!==
-
1
;
keypath
=
splitPath
.
join
();
options
.
bypass
=
path
.
indexOf
(
':'
)
!==
-
1
;
keypath
=
splitPath
.
join
(
'.'
);
if
(
model
)
{
if
(
dependencies
=
context
.
shift
())
{
options
.
dependencies
=
dependencies
.
split
(
/
\s
+/
);
}
if
(
eventRegExp
.
test
(
type
))
{
type
=
type
.
replace
(
eventRegExp
,
''
);
options
.
special
=
"event"
;
options
.
special
=
'event'
;
}
if
(
classRegExp
.
test
(
type
))
{
type
=
type
.
replace
(
classRegExp
,
''
);
options
.
special
=
"class"
;
options
.
special
=
'class'
;
}
if
(
iterationRegExp
.
test
(
type
))
{
type
=
type
.
replace
(
iterationRegExp
,
''
);
options
.
special
=
"iteration"
;
options
.
special
=
'iteration'
;
}
binding
=
new
Rivets
.
Binding
(
node
,
type
,
model
,
keypath
,
options
);
binding
.
view
=
_this
;
...
...
@@ -355,7 +355,7 @@
}
else
if
(
window
.
addEventListener
!=
null
)
{
return
el
.
addEventListener
(
event
,
fn
,
false
);
}
else
{
event
=
"on"
+
event
;
event
=
'on'
+
event
;
return
el
.
attachEvent
(
event
,
fn
);
}
};
...
...
@@ -371,7 +371,7 @@
}
else
if
(
window
.
removeEventListener
)
{
return
el
.
removeEventListener
(
event
,
fn
,
false
);
}
else
{
event
=
"on"
+
event
;
event
=
'on'
+
event
;
return
el
.
detachEvent
(
event
,
fn
);
}
};
...
...
@@ -402,7 +402,7 @@
elClass
=
" "
+
el
.
className
+
" "
;
hasClass
=
elClass
.
indexOf
(
" "
+
name
+
" "
)
!==
-
1
;
if
(
!
value
===
hasClass
)
{
return
el
.
className
=
value
?
""
+
el
.
className
+
" "
+
name
:
elClass
.
replace
(
" "
+
name
+
" "
,
" "
).
trim
();
return
el
.
className
=
value
?
""
+
el
.
className
+
" "
+
name
:
elClass
.
replace
(
" "
+
name
+
" "
,
' '
).
trim
();
}
};
};
...
...
lib/rivets.min.js
View file @
0d59fe3
This diff is collapsed.
Click to expand it.
package.json
View file @
0d59fe3
{
"name"
:
"rivets"
,
"description"
:
"Declarative data binding facility."
,
"version"
:
"0.3.
7
"
,
"version"
:
"0.3.
8
"
,
"author"
:
"Michael Richards"
,
"url"
:
"http://rivetsjs.com"
,
"main"
:
"./lib/rivets.js"
,
...
...
src/rivets.coffee
View file @
0d59fe3
# rivets.js
# version : 0.3.
7
# version : 0.3.
8
# author : Michael Richards
# license : MIT
...
...
Please
register
or
sign in
to post a comment