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
20ce9590
authored
2013-06-30 15:55:44 -0700
by
Michael Richards
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Build 0.5.10.
1 parent
203892c1
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
101 additions
and
7 deletions
component.json
dist/rivets.js
dist/rivets.min.js
package.json
src/rivets.coffee
component.json
View file @
20ce959
...
...
@@ -2,7 +2,7 @@
"name"
:
"rivets"
,
"repo"
:
"mikeric/rivets"
,
"description"
:
"Declarative data binding facility."
,
"version"
:
"0.5.
9
"
,
"version"
:
"0.5.
10
"
,
"keywords"
:
[
"data binding"
,
"templating"
],
"scripts"
:
[
"dist/rivets.js"
],
"main"
:
"dist/rivets.js"
,
...
...
dist/rivets.js
View file @
20ce959
// Rivets.js
// version: 0.5.
9
// version: 0.5.
10
// author: Michael Richards
// license: MIT
(
function
()
{
var
Rivets
,
__bind
=
function
(
fn
,
me
){
return
function
(){
return
fn
.
apply
(
me
,
arguments
);
};
},
__slice
=
[].
slice
,
__hasProp
=
{}.
hasOwnProperty
,
__extends
=
function
(
child
,
parent
)
{
for
(
var
key
in
parent
)
{
if
(
__hasProp
.
call
(
parent
,
key
))
child
[
key
]
=
parent
[
key
];
}
function
ctor
()
{
this
.
constructor
=
child
;
}
ctor
.
prototype
=
parent
.
prototype
;
child
.
prototype
=
new
ctor
();
child
.
__super__
=
parent
.
prototype
;
return
child
;
},
__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
;
};
Rivets
=
{};
...
...
@@ -204,6 +206,84 @@
})();
Rivets
.
ComponentBinding
=
(
function
(
_super
)
{
__extends
(
ComponentBinding
,
_super
);
function
ComponentBinding
(
view
,
el
,
type
)
{
var
attribute
,
_i
,
_len
,
_ref
,
_ref1
;
this
.
view
=
view
;
this
.
el
=
el
;
this
.
type
=
type
;
this
.
unbind
=
__bind
(
this
.
unbind
,
this
);
this
.
bind
=
__bind
(
this
.
bind
,
this
);
this
.
update
=
__bind
(
this
.
update
,
this
);
this
.
locals
=
__bind
(
this
.
locals
,
this
);
this
.
component
=
Rivets
.
components
[
this
.
type
];
this
.
attributes
=
{};
this
.
inflections
=
{};
_ref
=
this
.
el
.
attributes
||
[];
for
(
_i
=
0
,
_len
=
_ref
.
length
;
_i
<
_len
;
_i
++
)
{
attribute
=
_ref
[
_i
];
if
(
_ref1
=
attribute
.
name
,
__indexOf
.
call
(
this
.
component
.
attributes
,
_ref1
)
>=
0
)
{
this
.
attributes
[
attribute
.
name
]
=
attribute
.
value
;
}
else
{
this
.
inflections
[
attribute
.
name
]
=
attribute
.
value
;
}
}
}
ComponentBinding
.
prototype
.
sync
=
function
()
{};
ComponentBinding
.
prototype
.
locals
=
function
(
models
)
{
var
inverse
,
key
,
model
,
result
,
_ref
,
_ref1
;
if
(
models
==
null
)
{
models
=
this
.
view
.
models
;
}
result
=
{};
_ref
=
this
.
inflections
;
for
(
key
in
_ref
)
{
inverse
=
_ref
[
key
];
result
[
key
]
=
models
[
inverse
];
}
for
(
key
in
models
)
{
model
=
models
[
key
];
if
((
_ref1
=
result
[
key
])
==
null
)
{
result
[
key
]
=
model
;
}
}
return
result
;
};
ComponentBinding
.
prototype
.
update
=
function
(
models
)
{
var
_ref
;
return
(
_ref
=
this
.
componentView
)
!=
null
?
_ref
.
update
(
this
.
locals
(
models
))
:
void
0
;
};
ComponentBinding
.
prototype
.
bind
=
function
()
{
var
el
,
_ref
;
if
(
this
.
componentView
!=
null
)
{
return
(
_ref
=
this
.
componentView
)
!=
null
?
_ref
.
bind
()
:
void
0
;
}
else
{
el
=
this
.
component
.
build
.
call
(
this
.
attributes
);
(
this
.
componentView
=
new
Rivets
.
View
(
el
,
this
.
locals
(),
this
.
view
.
options
)).
bind
();
return
this
.
el
.
parentNode
.
replaceChild
(
el
,
this
.
el
);
}
};
ComponentBinding
.
prototype
.
unbind
=
function
()
{
var
_ref
;
return
(
_ref
=
this
.
componentView
)
!=
null
?
_ref
.
unbind
()
:
void
0
;
};
return
ComponentBinding
;
})(
Rivets
.
Binding
);
Rivets
.
View
=
(
function
()
{
function
View
(
els
,
models
,
options
)
{
var
k
,
option
,
v
,
_base
,
_i
,
_len
,
_ref
,
_ref1
,
_ref2
,
_ref3
;
...
...
@@ -218,6 +298,7 @@
this
.
bind
=
__bind
(
this
.
bind
,
this
);
this
.
select
=
__bind
(
this
.
select
,
this
);
this
.
build
=
__bind
(
this
.
build
,
this
);
this
.
componentRegExp
=
__bind
(
this
.
componentRegExp
,
this
);
this
.
bindingRegExp
=
__bind
(
this
.
bindingRegExp
,
this
);
if
(
!
(
this
.
els
.
jquery
||
this
.
els
instanceof
Array
))
{
this
.
els
=
[
this
.
els
];
...
...
@@ -255,13 +336,20 @@
}
};
View
.
prototype
.
componentRegExp
=
function
()
{
var
_ref
,
_ref1
;
return
new
RegExp
(
"^"
+
((
_ref
=
(
_ref1
=
this
.
config
.
prefix
)
!=
null
?
_ref1
.
toUpperCase
()
:
void
0
)
!=
null
?
_ref
:
'RV'
)
+
"-"
);
};
View
.
prototype
.
build
=
function
()
{
var
bindingRegExp
,
buildBinding
,
el
,
parse
,
skipNodes
,
_i
,
_len
,
_ref
,
var
bindingRegExp
,
buildBinding
,
componentRegExp
,
el
,
parse
,
skipNodes
,
_i
,
_len
,
_ref
,
_this
=
this
;
this
.
bindings
=
[];
skipNodes
=
[];
bindingRegExp
=
this
.
bindingRegExp
();
componentRegExp
=
this
.
componentRegExp
();
buildBinding
=
function
(
node
,
type
,
declaration
)
{
var
context
,
ctx
,
dependencies
,
key
,
keypath
,
options
,
path
,
pipe
,
pipes
,
splitPath
;
...
...
@@ -332,6 +420,9 @@
}
}
}
}
else
if
(
componentRegExp
.
test
(
node
.
tagName
))
{
type
=
node
.
tagName
.
replace
(
componentRegExp
,
''
).
toLowerCase
();
_this
.
bindings
.
push
(
new
Rivets
.
ComponentBinding
(
_this
,
node
,
type
));
}
else
if
(
node
.
attributes
!=
null
)
{
_ref
=
node
.
attributes
;
for
(
_j
=
0
,
_len1
=
_ref
.
length
;
_j
<
_len1
;
_j
++
)
{
...
...
@@ -885,6 +976,8 @@
}
};
Rivets
.
components
=
{};
Rivets
.
config
=
{
preloadData
:
true
,
handler
:
function
(
context
,
ev
,
binding
)
{
...
...
@@ -897,6 +990,7 @@
Rivets
.
factory
=
function
(
exports
)
{
exports
.
_
=
Rivets
;
exports
.
binders
=
Rivets
.
binders
;
exports
.
components
=
Rivets
.
components
;
exports
.
formatters
=
Rivets
.
formatters
;
exports
.
config
=
Rivets
.
config
;
exports
.
configure
=
function
(
options
)
{
...
...
dist/rivets.min.js
View file @
20ce959
// Rivets.js
// version: 0.5.
9
// version: 0.5.
10
// author: Michael Richards
// license: MIT
(
function
(){
var
t
,
e
=
function
(
t
,
e
){
return
function
(){
return
t
.
apply
(
e
,
arguments
)}},
i
=
[].
slice
,
n
=
[].
indexOf
||
function
(
t
){
for
(
var
e
=
0
,
i
=
this
.
length
;
i
>
e
;
e
++
)
if
(
e
in
this
&&
this
[
e
]
===
t
)
return
e
;
return
-
1
};
t
=
{},
String
.
prototype
.
trim
||
(
String
.
prototype
.
trim
=
function
(){
return
this
.
replace
(
/^
\s
+|
\s
+$/g
,
""
)}),
t
.
Binding
=
function
(){
function
n
(
i
,
n
,
s
,
r
,
h
,
o
){
var
u
,
l
,
a
,
d
;
if
(
this
.
view
=
i
,
this
.
el
=
n
,
this
.
type
=
s
,
this
.
key
=
r
,
this
.
keypath
=
h
,
this
.
options
=
null
!=
o
?
o
:{},
this
.
update
=
e
(
this
.
update
,
this
),
this
.
unbind
=
e
(
this
.
unbind
,
this
),
this
.
bind
=
e
(
this
.
bind
,
this
),
this
.
publish
=
e
(
this
.
publish
,
this
),
this
.
sync
=
e
(
this
.
sync
,
this
),
this
.
set
=
e
(
this
.
set
,
this
),
this
.
eventHandler
=
e
(
this
.
eventHandler
,
this
),
this
.
formattedValue
=
e
(
this
.
formattedValue
,
this
),
!
(
this
.
binder
=
t
.
internalBinders
[
this
.
type
]
||
this
.
view
.
binders
[
s
])){
d
=
this
.
view
.
binders
;
for
(
u
in
d
)
a
=
d
[
u
],
"*"
!==
u
&&-
1
!==
u
.
indexOf
(
"*"
)
&&
(
l
=
RegExp
(
"^"
+
u
.
replace
(
"*"
,
".+"
)
+
"$"
),
l
.
test
(
s
)
&&
(
this
.
binder
=
a
,
this
.
args
=
RegExp
(
"^"
+
u
.
replace
(
"*"
,
"(.+)"
)
+
"$"
).
exec
(
s
),
this
.
args
.
shift
()))}
this
.
binder
||
(
this
.
binder
=
this
.
view
.
binders
[
"*"
]),
this
.
binder
instanceof
Function
&&
(
this
.
binder
=
{
routine
:
this
.
binder
}),
this
.
formatters
=
this
.
options
.
formatters
||
[],
this
.
model
=
this
.
key
?
this
.
view
.
models
[
this
.
key
]:
this
.
view
.
models
}
return
n
.
prototype
.
formattedValue
=
function
(
t
){
var
e
,
n
,
s
,
r
,
h
,
o
;
for
(
o
=
this
.
formatters
,
r
=
0
,
h
=
o
.
length
;
h
>
r
;
r
++
)
n
=
o
[
r
],
e
=
n
.
split
(
/
\s
+/
),
s
=
e
.
shift
(),
n
=
this
.
model
[
s
]
instanceof
Function
?
this
.
model
[
s
]:
this
.
view
.
formatters
[
s
],(
null
!=
n
?
n
.
read
:
void
0
)
instanceof
Function
?
t
=
n
.
read
.
apply
(
n
,[
t
].
concat
(
i
.
call
(
e
))):
n
instanceof
Function
&&
(
t
=
n
.
apply
(
null
,[
t
].
concat
(
i
.
call
(
e
))));
return
t
},
n
.
prototype
.
eventHandler
=
function
(
t
){
var
e
,
i
;
return
i
=
(
e
=
this
).
view
.
config
.
handler
,
function
(
n
){
return
i
.
call
(
t
,
this
,
n
,
e
)}},
n
.
prototype
.
set
=
function
(
t
){
var
e
;
return
t
=
t
instanceof
Function
&&!
this
.
binder
[
"function"
]?
this
.
formattedValue
(
t
.
call
(
this
.
model
)):
this
.
formattedValue
(
t
),
null
!=
(
e
=
this
.
binder
.
routine
)?
e
.
call
(
this
,
this
.
el
,
t
):
void
0
},
n
.
prototype
.
sync
=
function
(){
return
this
.
set
(
this
.
options
.
bypass
?
this
.
model
[
this
.
keypath
]:
this
.
view
.
config
.
adapter
.
read
(
this
.
model
,
this
.
keypath
))},
n
.
prototype
.
publish
=
function
(){
var
e
,
n
,
s
,
r
,
h
,
o
,
u
,
l
,
a
;
for
(
r
=
t
.
Util
.
getInputValue
(
this
.
el
),
u
=
this
.
formatters
.
slice
(
0
).
reverse
(),
h
=
0
,
o
=
u
.
length
;
o
>
h
;
h
++
)
n
=
u
[
h
],
e
=
n
.
split
(
/
\s
+/
),
s
=
e
.
shift
(),(
null
!=
(
l
=
this
.
view
.
formatters
[
s
])?
l
.
publish
:
void
0
)
&&
(
r
=
(
a
=
this
.
view
.
formatters
[
s
]).
publish
.
apply
(
a
,[
r
].
concat
(
i
.
call
(
e
))));
return
this
.
view
.
config
.
adapter
.
publish
(
this
.
model
,
this
.
keypath
,
r
)},
n
.
prototype
.
bind
=
function
(){
var
t
,
e
,
i
,
n
,
s
,
r
,
h
,
o
,
u
;
if
(
null
!=
(
r
=
this
.
binder
.
bind
)
&&
r
.
call
(
this
,
this
.
el
),
this
.
options
.
bypass
?
this
.
sync
():(
this
.
view
.
config
.
adapter
.
subscribe
(
this
.
model
,
this
.
keypath
,
this
.
sync
),
this
.
view
.
config
.
preloadData
&&
this
.
sync
()),
null
!=
(
h
=
this
.
options
.
dependencies
)?
h
.
length
:
void
0
){
for
(
o
=
this
.
options
.
dependencies
,
u
=
[],
n
=
0
,
s
=
o
.
length
;
s
>
n
;
n
++
)
t
=
o
[
n
],
/^
\.
/
.
test
(
t
)?(
i
=
this
.
model
,
e
=
t
.
substr
(
1
)):(
t
=
t
.
split
(
"."
),
i
=
this
.
view
.
models
[
t
.
shift
()],
e
=
t
.
join
(
"."
)),
u
.
push
(
this
.
view
.
config
.
adapter
.
subscribe
(
i
,
e
,
this
.
sync
));
return
u
}},
n
.
prototype
.
unbind
=
function
(){
var
t
,
e
,
i
,
n
,
s
,
r
,
h
,
o
,
u
;
if
(
null
!=
(
r
=
this
.
binder
.
unbind
)
&&
r
.
call
(
this
,
this
.
el
),
this
.
options
.
bypass
||
this
.
view
.
config
.
adapter
.
unsubscribe
(
this
.
model
,
this
.
keypath
,
this
.
sync
),
null
!=
(
h
=
this
.
options
.
dependencies
)?
h
.
length
:
void
0
){
for
(
o
=
this
.
options
.
dependencies
,
u
=
[],
n
=
0
,
s
=
o
.
length
;
s
>
n
;
n
++
)
t
=
o
[
n
],
/^
\.
/
.
test
(
t
)?(
i
=
this
.
model
,
e
=
t
.
substr
(
1
)):(
t
=
t
.
split
(
"."
),
i
=
this
.
view
.
models
[
t
.
shift
()],
e
=
t
.
join
(
"."
)),
u
.
push
(
this
.
view
.
config
.
adapter
.
unsubscribe
(
i
,
e
,
this
.
sync
));
return
u
}},
n
.
prototype
.
update
=
function
(
t
){
var
e
;
return
null
==
t
&&
(
t
=
{}),
this
.
key
?
t
[
this
.
key
]
&&
(
this
.
options
.
bypass
||
this
.
view
.
config
.
adapter
.
unsubscribe
(
this
.
model
,
this
.
keypath
,
this
.
sync
),
this
.
model
=
t
[
this
.
key
],
this
.
options
.
bypass
?
this
.
sync
():(
this
.
view
.
config
.
adapter
.
subscribe
(
this
.
model
,
this
.
keypath
,
this
.
sync
),
this
.
view
.
config
.
preloadData
&&
this
.
sync
())):
this
.
sync
(),
null
!=
(
e
=
this
.
binder
.
update
)?
e
.
call
(
this
,
t
):
void
0
},
n
}(),
t
.
View
=
function
(){
function
s
(
i
,
n
,
s
){
var
r
,
h
,
o
,
u
,
l
,
a
,
d
,
c
,
p
,
f
;
for
(
this
.
els
=
i
,
this
.
models
=
n
,
this
.
options
=
null
!=
s
?
s
:{},
this
.
update
=
e
(
this
.
update
,
this
),
this
.
publish
=
e
(
this
.
publish
,
this
),
this
.
sync
=
e
(
this
.
sync
,
this
),
this
.
unbind
=
e
(
this
.
unbind
,
this
),
this
.
bind
=
e
(
this
.
bind
,
this
),
this
.
select
=
e
(
this
.
select
,
this
),
this
.
build
=
e
(
this
.
build
,
this
),
this
.
bindingRegExp
=
e
(
this
.
bindingRegExp
,
this
),
this
.
els
.
jquery
||
this
.
els
instanceof
Array
||
(
this
.
els
=
[
this
.
els
]),
d
=
[
"config"
,
"binders"
,
"formatters"
],
l
=
0
,
a
=
d
.
length
;
a
>
l
;
l
++
){
if
(
h
=
d
[
l
],
this
[
h
]
=
{},
this
.
options
[
h
]){
c
=
this
.
options
[
h
];
for
(
r
in
c
)
o
=
c
[
r
],
this
[
h
][
r
]
=
o
}
p
=
t
[
h
];
for
(
r
in
p
)
o
=
p
[
r
],
null
==
(
f
=
(
u
=
this
[
h
])[
r
])
&&
(
u
[
r
]
=
o
)}
this
.
build
()}
return
s
.
prototype
.
bindingRegExp
=
function
(){
var
t
;
return
t
=
this
.
config
.
prefix
,
t
?
RegExp
(
"^data-"
+
t
+
"-"
):
/^data-/
},
s
.
prototype
.
build
=
function
(){
var
e
,
s
,
r
,
h
,
o
,
u
,
l
,
a
,
d
=
this
;
for
(
this
.
bindings
=
[],
o
=
[],
e
=
this
.
bindingRegExp
(),
s
=
function
(
e
,
i
,
n
){
var
s
,
r
,
h
,
o
,
u
,
l
,
a
,
c
,
p
,
f
;
return
l
=
{},
p
=
function
(){
var
t
,
e
,
i
,
s
;
for
(
i
=
n
.
split
(
"|"
),
s
=
[],
t
=
0
,
e
=
i
.
length
;
e
>
t
;
t
++
)
c
=
i
[
t
],
s
.
push
(
c
.
trim
());
return
s
}(),
s
=
function
(){
var
t
,
e
,
i
,
n
;
for
(
i
=
p
.
shift
().
split
(
"<"
),
n
=
[],
t
=
0
,
e
=
i
.
length
;
e
>
t
;
t
++
)
r
=
i
[
t
],
n
.
push
(
r
.
trim
());
return
n
}(),
a
=
s
.
shift
(),
f
=
a
.
split
(
/
\.
|:/
),
l
.
formatters
=
p
,
l
.
bypass
=-
1
!==
a
.
indexOf
(
":"
),
f
[
0
]?
o
=
f
.
shift
():(
o
=
null
,
f
.
shift
()),
u
=
f
.
join
(
"."
),(
h
=
s
.
shift
())
&&
(
l
.
dependencies
=
h
.
split
(
/
\s
+/
)),
d
.
bindings
.
push
(
new
t
.
Binding
(
d
,
e
,
i
,
o
,
u
,
l
))},
h
=
function
(
r
){
var
u
,
l
,
a
,
c
,
p
,
f
,
b
,
v
,
g
,
y
,
m
,
w
,
x
,
k
,
E
,
N
,
j
,
T
,
U
,
V
,
B
,
C
,
O
,
Q
,
R
,
A
,
D
,
F
,
H
,
L
,
S
,
$
;
if
(
0
>
n
.
call
(
o
,
r
)){
if
(
r
.
nodeType
===
Node
.
TEXT_NODE
){
if
(
v
=
t
.
TextTemplateParser
,(
p
=
d
.
config
.
templateDelimiters
)
&&
(
k
=
v
.
parse
(
r
.
data
,
p
)).
length
&&
(
1
!==
k
.
length
||
k
[
0
].
type
!==
v
.
types
.
text
)){
switch
(
m
=
k
[
0
],
y
=
k
.
length
>=
2
?
i
.
call
(
k
,
1
):[],
r
.
data
=
m
.
value
,
m
.
type
){
case
0
:
r
.
data
=
m
.
value
;
break
;
case
1
:
s
(
r
,
"textNode"
,
m
.
value
)}
for
(
j
=
0
,
B
=
y
.
length
;
B
>
j
;
j
++
)
x
=
y
[
j
],
r
.
parentNode
.
appendChild
(
w
=
document
.
createTextNode
(
x
.
value
)),
1
===
x
.
type
&&
s
(
w
,
"textNode"
,
x
.
value
)}}
else
if
(
null
!=
r
.
attributes
){
for
(
D
=
r
.
attributes
,
T
=
0
,
C
=
D
.
length
;
C
>
T
;
T
++
)
if
(
u
=
D
[
T
],
e
.
test
(
u
.
name
)){
if
(
E
=
u
.
name
.
replace
(
e
,
""
),
!
(
a
=
d
.
binders
[
E
])){
F
=
d
.
binders
;
for
(
f
in
F
)
N
=
F
[
f
],
"*"
!==
f
&&-
1
!==
f
.
indexOf
(
"*"
)
&&
(
g
=
RegExp
(
"^"
+
f
.
replace
(
"*"
,
".+"
)
+
"$"
),
g
.
test
(
E
)
&&
(
a
=
N
))}
if
(
a
||
(
a
=
d
.
binders
[
"*"
]),
a
.
block
){
for
(
H
=
r
.
childNodes
,
U
=
0
,
O
=
H
.
length
;
O
>
U
;
U
++
)
b
=
H
[
U
],
o
.
push
(
b
);
l
=
[
u
]}}
for
(
L
=
l
||
r
.
attributes
,
V
=
0
,
Q
=
L
.
length
;
Q
>
V
;
V
++
)
u
=
L
[
V
],
e
.
test
(
u
.
name
)
&&
(
E
=
u
.
name
.
replace
(
e
,
""
),
s
(
r
,
E
,
u
.
value
))}
for
(
S
=
r
.
childNodes
,
$
=
[],
A
=
0
,
R
=
S
.
length
;
R
>
A
;
A
++
)
c
=
S
[
A
],
$
.
push
(
h
(
c
));
return
$
}},
a
=
this
.
els
,
u
=
0
,
l
=
a
.
length
;
l
>
u
;
u
++
)
r
=
a
[
u
],
h
(
r
)},
s
.
prototype
.
select
=
function
(
t
){
var
e
,
i
,
n
,
s
,
r
;
for
(
s
=
this
.
bindings
,
r
=
[],
i
=
0
,
n
=
s
.
length
;
n
>
i
;
i
++
)
e
=
s
[
i
],
t
(
e
)
&&
r
.
push
(
e
);
return
r
},
s
.
prototype
.
bind
=
function
(){
var
t
,
e
,
i
,
n
,
s
;
for
(
n
=
this
.
bindings
,
s
=
[],
e
=
0
,
i
=
n
.
length
;
i
>
e
;
e
++
)
t
=
n
[
e
],
s
.
push
(
t
.
bind
());
return
s
},
s
.
prototype
.
unbind
=
function
(){
var
t
,
e
,
i
,
n
,
s
;
for
(
n
=
this
.
bindings
,
s
=
[],
e
=
0
,
i
=
n
.
length
;
i
>
e
;
e
++
)
t
=
n
[
e
],
s
.
push
(
t
.
unbind
());
return
s
},
s
.
prototype
.
sync
=
function
(){
var
t
,
e
,
i
,
n
,
s
;
for
(
n
=
this
.
bindings
,
s
=
[],
e
=
0
,
i
=
n
.
length
;
i
>
e
;
e
++
)
t
=
n
[
e
],
s
.
push
(
t
.
sync
());
return
s
},
s
.
prototype
.
publish
=
function
(){
var
t
,
e
,
i
,
n
,
s
;
for
(
n
=
this
.
select
(
function
(
t
){
return
t
.
binder
.
publishes
}),
s
=
[],
e
=
0
,
i
=
n
.
length
;
i
>
e
;
e
++
)
t
=
n
[
e
],
s
.
push
(
t
.
publish
());
return
s
},
s
.
prototype
.
update
=
function
(
t
){
var
e
,
i
,
n
,
s
,
r
,
h
,
o
;
null
==
t
&&
(
t
=
{});
for
(
i
in
t
)
n
=
t
[
i
],
this
.
models
[
i
]
=
n
;
for
(
h
=
this
.
bindings
,
o
=
[],
s
=
0
,
r
=
h
.
length
;
r
>
s
;
s
++
)
e
=
h
[
s
],
o
.
push
(
e
.
update
(
t
));
return
o
},
s
}(),
t
.
TextTemplateParser
=
function
(){
function
t
(){}
return
t
.
types
=
{
text
:
0
,
binding
:
1
},
t
.
parse
=
function
(
t
,
e
){
var
i
,
n
,
s
,
r
,
h
,
o
,
u
;
for
(
o
=
[],
r
=
t
.
length
,
i
=
0
,
n
=
0
;
r
>
n
;){
if
(
i
=
t
.
indexOf
(
e
[
0
],
n
),
0
>
i
){
o
.
push
({
type
:
this
.
types
.
text
,
value
:
t
.
slice
(
n
)});
break
}
if
(
i
>
0
&&
i
>
n
&&
o
.
push
({
type
:
this
.
types
.
text
,
value
:
t
.
slice
(
n
,
i
)}),
n
=
i
+
2
,
i
=
t
.
indexOf
(
e
[
1
],
n
),
0
>
i
){
h
=
t
.
slice
(
n
-
2
),
s
=
o
[
o
.
length
-
1
],(
null
!=
s
?
s
.
type
:
void
0
)
===
this
.
types
.
text
?
s
.
value
+=
h
:
o
.
push
({
type
:
this
.
types
.
text
,
value
:
h
});
break
}
u
=
t
.
slice
(
n
,
i
).
trim
(),
o
.
push
({
type
:
this
.
types
.
binding
,
value
:
u
}),
n
=
i
+
2
}
return
o
},
t
}(),
t
.
Util
=
{
bindEvent
:
function
(
t
,
e
,
i
){
return
null
!=
window
.
jQuery
?(
t
=
jQuery
(
t
),
null
!=
t
.
on
?
t
.
on
(
e
,
i
):
t
.
bind
(
e
,
i
)):
null
!=
window
.
addEventListener
?
t
.
addEventListener
(
e
,
i
,
!
1
):(
e
=
"on"
+
e
,
t
.
attachEvent
(
e
,
i
))},
unbindEvent
:
function
(
t
,
e
,
i
){
return
null
!=
window
.
jQuery
?(
t
=
jQuery
(
t
),
null
!=
t
.
off
?
t
.
off
(
e
,
i
):
t
.
unbind
(
e
,
i
)):
null
!=
window
.
removeEventListener
?
t
.
removeEventListener
(
e
,
i
,
!
1
):(
e
=
"on"
+
e
,
t
.
detachEvent
(
e
,
i
))},
getInputValue
:
function
(
t
){
var
e
,
i
,
n
,
s
;
if
(
null
!=
window
.
jQuery
)
switch
(
t
=
jQuery
(
t
),
t
[
0
].
type
){
case
"checkbox"
:
return
t
.
is
(
":checked"
);
default
:
return
t
.
val
()}
else
switch
(
t
.
type
){
case
"checkbox"
:
return
t
.
checked
;
case
"select-multiple"
:
for
(
s
=
[],
i
=
0
,
n
=
t
.
length
;
n
>
i
;
i
++
)
e
=
t
[
i
],
e
.
selected
&&
s
.
push
(
e
.
value
);
return
s
;
default
:
return
t
.
value
}}},
t
.
binders
=
{
enabled
:
function
(
t
,
e
){
return
t
.
disabled
=!
e
},
disabled
:
function
(
t
,
e
){
return
t
.
disabled
=!!
e
},
checked
:{
publishes
:
!
0
,
bind
:
function
(
e
){
return
t
.
Util
.
bindEvent
(
e
,
"change"
,
this
.
publish
)},
unbind
:
function
(
e
){
return
t
.
Util
.
unbindEvent
(
e
,
"change"
,
this
.
publish
)},
routine
:
function
(
t
,
e
){
var
i
;
return
t
.
checked
=
"radio"
===
t
.
type
?(
null
!=
(
i
=
t
.
value
)?
""
+
i
:
void
0
)
===
(
null
!=
e
?
""
+
e
:
void
0
):
!!
e
}},
unchecked
:{
publishes
:
!
0
,
bind
:
function
(
e
){
return
t
.
Util
.
bindEvent
(
e
,
"change"
,
this
.
publish
)},
unbind
:
function
(
e
){
return
t
.
Util
.
unbindEvent
(
e
,
"change"
,
this
.
publish
)},
routine
:
function
(
t
,
e
){
var
i
;
return
t
.
checked
=
"radio"
===
t
.
type
?(
null
!=
(
i
=
t
.
value
)?
""
+
i
:
void
0
)
!==
(
null
!=
e
?
""
+
e
:
void
0
):
!
e
}},
show
:
function
(
t
,
e
){
return
t
.
style
.
display
=
e
?
""
:
"none"
},
hide
:
function
(
t
,
e
){
return
t
.
style
.
display
=
e
?
"none"
:
""
},
html
:
function
(
t
,
e
){
return
t
.
innerHTML
=
null
!=
e
?
e
:
""
},
value
:{
publishes
:
!
0
,
bind
:
function
(
e
){
return
t
.
Util
.
bindEvent
(
e
,
"change"
,
this
.
publish
)},
unbind
:
function
(
e
){
return
t
.
Util
.
unbindEvent
(
e
,
"change"
,
this
.
publish
)},
routine
:
function
(
t
,
e
){
var
i
,
s
,
r
,
h
,
o
,
u
,
l
;
if
(
null
!=
window
.
jQuery
){
if
(
t
=
jQuery
(
t
),(
null
!=
e
?
""
+
e
:
void
0
)
!==
(
null
!=
(
h
=
t
.
val
())?
""
+
h
:
void
0
))
return
t
.
val
(
null
!=
e
?
e
:
""
)}
else
if
(
"select-multiple"
===
t
.
type
){
if
(
null
!=
e
){
for
(
l
=
[],
s
=
0
,
r
=
t
.
length
;
r
>
s
;
s
++
)
i
=
t
[
s
],
l
.
push
(
i
.
selected
=
(
o
=
i
.
value
,
n
.
call
(
e
,
o
)
>=
0
));
return
l
}}
else
if
((
null
!=
e
?
""
+
e
:
void
0
)
!==
(
null
!=
(
u
=
t
.
value
)?
""
+
u
:
void
0
))
return
t
.
value
=
null
!=
e
?
e
:
""
}},
text
:
function
(
t
,
e
){
return
null
!=
t
.
innerText
?
t
.
innerText
=
null
!=
e
?
e
:
""
:
t
.
textContent
=
null
!=
e
?
e
:
""
},
"if"
:{
block
:
!
0
,
bind
:
function
(
t
){
var
e
,
i
;
return
null
==
this
.
marker
?(
e
=
[
"data"
,
this
.
view
.
config
.
prefix
,
this
.
type
].
join
(
"-"
).
replace
(
"--"
,
"-"
),
i
=
t
.
getAttribute
(
e
),
this
.
marker
=
document
.
createComment
(
" rivets: "
+
this
.
type
+
" "
+
i
+
" "
),
t
.
removeAttribute
(
e
),
t
.
parentNode
.
insertBefore
(
this
.
marker
,
t
),
t
.
parentNode
.
removeChild
(
t
)):
void
0
},
unbind
:
function
(){
var
t
;
return
null
!=
(
t
=
this
.
nested
)?
t
.
unbind
():
void
0
},
routine
:
function
(
e
,
i
){
var
n
,
s
,
r
,
h
,
o
;
if
(
!!
i
==
(
null
==
this
.
nested
)){
if
(
i
){
r
=
{},
o
=
this
.
view
.
models
;
for
(
n
in
o
)
s
=
o
[
n
],
r
[
n
]
=
s
;
return
h
=
{
binders
:
this
.
view
.
options
.
binders
,
formatters
:
this
.
view
.
options
.
formatters
,
config
:
this
.
view
.
options
.
config
},(
this
.
nested
=
new
t
.
View
(
e
,
r
,
h
)).
bind
(),
this
.
marker
.
parentNode
.
insertBefore
(
e
,
this
.
marker
.
nextSibling
)}
return
e
.
parentNode
.
removeChild
(
e
),
this
.
nested
.
unbind
(),
delete
this
.
nested
}},
update
:
function
(
t
){
return
this
.
nested
.
update
(
t
)}},
unless
:{
block
:
!
0
,
bind
:
function
(
e
){
return
t
.
binders
[
"if"
].
bind
.
call
(
this
,
e
)},
unbind
:
function
(){
return
t
.
binders
[
"if"
].
unbind
.
call
(
this
)},
routine
:
function
(
e
,
i
){
return
t
.
binders
[
"if"
].
routine
.
call
(
this
,
e
,
!
i
)},
update
:
function
(
e
){
return
t
.
binders
[
"if"
].
update
.
call
(
this
,
e
)}},
"on-*"
:{
"function"
:
!
0
,
unbind
:
function
(
e
){
return
this
.
handler
?
t
.
Util
.
unbindEvent
(
e
,
this
.
args
[
0
],
this
.
handler
):
void
0
},
routine
:
function
(
e
,
i
){
return
this
.
handler
&&
t
.
Util
.
unbindEvent
(
e
,
this
.
args
[
0
],
this
.
handler
),
t
.
Util
.
bindEvent
(
e
,
this
.
args
[
0
],
this
.
handler
=
this
.
eventHandler
(
i
))}},
"each-*"
:{
block
:
!
0
,
bind
:
function
(
t
){
var
e
;
return
null
==
this
.
marker
?(
e
=
[
"data"
,
this
.
view
.
config
.
prefix
,
this
.
type
].
join
(
"-"
).
replace
(
"--"
,
"-"
),
this
.
marker
=
document
.
createComment
(
" rivets: "
+
this
.
type
+
" "
),
this
.
iterated
=
[],
t
.
removeAttribute
(
e
),
t
.
parentNode
.
insertBefore
(
this
.
marker
,
t
),
t
.
parentNode
.
removeChild
(
t
)):
void
0
},
unbind
:
function
(){
var
t
,
e
,
i
,
n
,
s
;
if
(
null
!=
this
.
iterated
){
for
(
n
=
this
.
iterated
,
s
=
[],
e
=
0
,
i
=
n
.
length
;
i
>
e
;
e
++
)
t
=
n
[
e
],
s
.
push
(
t
.
unbind
());
return
s
}},
routine
:
function
(
e
,
i
){
var
n
,
s
,
r
,
h
,
o
,
u
,
l
,
a
,
d
,
c
,
p
,
f
,
b
,
v
,
g
,
y
,
m
,
w
,
x
,
k
,
E
;
if
(
l
=
this
.
args
[
0
],
i
=
i
||
[],
this
.
iterated
.
length
>
i
.
length
)
for
(
m
=
Array
(
this
.
iterated
.
length
-
i
.
length
),
b
=
0
,
g
=
m
.
length
;
g
>
b
;
b
++
)
s
=
m
[
b
],
f
=
this
.
iterated
.
pop
(),
f
.
unbind
(),
this
.
marker
.
parentNode
.
removeChild
(
f
.
els
[
0
]);
for
(
E
=
[],
r
=
v
=
0
,
y
=
i
.
length
;
y
>
v
;
r
=++
v
)
if
(
u
=
i
[
r
],
n
=
{},
n
[
l
]
=
u
,
null
==
this
.
iterated
[
r
]){
w
=
this
.
view
.
models
;
for
(
o
in
w
)
u
=
w
[
o
],
null
==
(
x
=
n
[
o
])
&&
(
n
[
o
]
=
u
);
d
=
this
.
iterated
.
length
?
this
.
iterated
[
this
.
iterated
.
length
-
1
].
els
[
0
]:
this
.
marker
,
a
=
{
binders
:
this
.
view
.
options
.
binders
,
formatters
:
this
.
view
.
options
.
formatters
,
config
:{}},
k
=
this
.
view
.
options
.
config
;
for
(
h
in
k
)
p
=
k
[
h
],
a
.
config
[
h
]
=
p
;
a
.
config
.
preloadData
=!
0
,
c
=
e
.
cloneNode
(
!
0
),
f
=
new
t
.
View
(
c
,
n
,
a
),
f
.
bind
(),
this
.
iterated
.
push
(
f
),
E
.
push
(
this
.
marker
.
parentNode
.
insertBefore
(
c
,
d
.
nextSibling
))}
else
this
.
iterated
[
r
].
models
[
l
]
!==
u
?
E
.
push
(
this
.
iterated
[
r
].
update
(
n
)):
E
.
push
(
void
0
);
return
E
},
update
:
function
(
t
){
var
e
,
i
,
n
,
s
,
r
,
h
,
o
,
u
;
e
=
{};
for
(
i
in
t
)
n
=
t
[
i
],
i
!==
this
.
args
[
0
]
&&
(
e
[
i
]
=
n
);
for
(
o
=
this
.
iterated
,
u
=
[],
r
=
0
,
h
=
o
.
length
;
h
>
r
;
r
++
)
s
=
o
[
r
],
u
.
push
(
s
.
update
(
e
));
return
u
}},
"class-*"
:
function
(
t
,
e
){
var
i
;
return
i
=
" "
+
t
.
className
+
" "
,
!
e
==
(
-
1
!==
i
.
indexOf
(
" "
+
this
.
args
[
0
]
+
" "
))?
t
.
className
=
e
?
""
+
t
.
className
+
" "
+
this
.
args
[
0
]:
i
.
replace
(
" "
+
this
.
args
[
0
]
+
" "
,
" "
).
trim
():
void
0
},
"*"
:
function
(
t
,
e
){
return
e
?
t
.
setAttribute
(
this
.
type
,
e
):
t
.
removeAttribute
(
this
.
type
)}},
t
.
internalBinders
=
{
textNode
:
function
(
t
,
e
){
return
t
.
data
=
null
!=
e
?
e
:
""
}},
t
.
config
=
{
preloadData
:
!
0
,
handler
:
function
(
t
,
e
,
i
){
return
this
.
call
(
t
,
e
,
i
.
view
.
models
)}},
t
.
formatters
=
{},
t
.
factory
=
function
(
e
){
return
e
.
_
=
t
,
e
.
binders
=
t
.
binders
,
e
.
formatters
=
t
.
formatters
,
e
.
config
=
t
.
config
,
e
.
configure
=
function
(
e
){
var
i
,
n
;
null
==
e
&&
(
e
=
{});
for
(
i
in
e
)
n
=
e
[
i
],
t
.
config
[
i
]
=
n
},
e
.
bind
=
function
(
e
,
i
,
n
){
var
s
;
return
null
==
i
&&
(
i
=
{}),
null
==
n
&&
(
n
=
{}),
s
=
new
t
.
View
(
e
,
i
,
n
),
s
.
bind
(),
s
}},
"object"
==
typeof
exports
?
t
.
factory
(
exports
):
"function"
==
typeof
define
&&
define
.
amd
?
define
([
"exports"
],
function
(
e
){
return
t
.
factory
(
this
.
rivets
=
e
),
e
}):
t
.
factory
(
this
.
rivets
=
{})}).
call
(
this
);
\ No newline at end of file
(
function
(){
var
t
,
i
=
function
(
t
,
i
){
return
function
(){
return
t
.
apply
(
i
,
arguments
)}},
e
=
[].
slice
,
n
=
{}.
hasOwnProperty
,
s
=
function
(
t
,
i
){
function
e
(){
this
.
constructor
=
t
}
for
(
var
s
in
i
)
n
.
call
(
i
,
s
)
&&
(
t
[
s
]
=
i
[
s
]);
return
e
.
prototype
=
i
.
prototype
,
t
.
prototype
=
new
e
,
t
.
__super__
=
i
.
prototype
,
t
},
r
=
[].
indexOf
||
function
(
t
){
for
(
var
i
=
0
,
e
=
this
.
length
;
e
>
i
;
i
++
)
if
(
i
in
this
&&
this
[
i
]
===
t
)
return
i
;
return
-
1
};
t
=
{},
String
.
prototype
.
trim
||
(
String
.
prototype
.
trim
=
function
(){
return
this
.
replace
(
/^
\s
+|
\s
+$/g
,
""
)}),
t
.
Binding
=
function
(){
function
n
(
e
,
n
,
s
,
r
,
o
,
h
){
var
l
,
u
,
a
,
d
;
if
(
this
.
view
=
e
,
this
.
el
=
n
,
this
.
type
=
s
,
this
.
key
=
r
,
this
.
keypath
=
o
,
this
.
options
=
null
!=
h
?
h
:{},
this
.
update
=
i
(
this
.
update
,
this
),
this
.
unbind
=
i
(
this
.
unbind
,
this
),
this
.
bind
=
i
(
this
.
bind
,
this
),
this
.
publish
=
i
(
this
.
publish
,
this
),
this
.
sync
=
i
(
this
.
sync
,
this
),
this
.
set
=
i
(
this
.
set
,
this
),
this
.
eventHandler
=
i
(
this
.
eventHandler
,
this
),
this
.
formattedValue
=
i
(
this
.
formattedValue
,
this
),
!
(
this
.
binder
=
t
.
internalBinders
[
this
.
type
]
||
this
.
view
.
binders
[
s
])){
d
=
this
.
view
.
binders
;
for
(
l
in
d
)
a
=
d
[
l
],
"*"
!==
l
&&-
1
!==
l
.
indexOf
(
"*"
)
&&
(
u
=
RegExp
(
"^"
+
l
.
replace
(
"*"
,
".+"
)
+
"$"
),
u
.
test
(
s
)
&&
(
this
.
binder
=
a
,
this
.
args
=
RegExp
(
"^"
+
l
.
replace
(
"*"
,
"(.+)"
)
+
"$"
).
exec
(
s
),
this
.
args
.
shift
()))}
this
.
binder
||
(
this
.
binder
=
this
.
view
.
binders
[
"*"
]),
this
.
binder
instanceof
Function
&&
(
this
.
binder
=
{
routine
:
this
.
binder
}),
this
.
formatters
=
this
.
options
.
formatters
||
[],
this
.
model
=
this
.
key
?
this
.
view
.
models
[
this
.
key
]:
this
.
view
.
models
}
return
n
.
prototype
.
formattedValue
=
function
(
t
){
var
i
,
n
,
s
,
r
,
o
,
h
;
for
(
h
=
this
.
formatters
,
r
=
0
,
o
=
h
.
length
;
o
>
r
;
r
++
)
n
=
h
[
r
],
i
=
n
.
split
(
/
\s
+/
),
s
=
i
.
shift
(),
n
=
this
.
model
[
s
]
instanceof
Function
?
this
.
model
[
s
]:
this
.
view
.
formatters
[
s
],(
null
!=
n
?
n
.
read
:
void
0
)
instanceof
Function
?
t
=
n
.
read
.
apply
(
n
,[
t
].
concat
(
e
.
call
(
i
))):
n
instanceof
Function
&&
(
t
=
n
.
apply
(
null
,[
t
].
concat
(
e
.
call
(
i
))));
return
t
},
n
.
prototype
.
eventHandler
=
function
(
t
){
var
i
,
e
;
return
e
=
(
i
=
this
).
view
.
config
.
handler
,
function
(
n
){
return
e
.
call
(
t
,
this
,
n
,
i
)}},
n
.
prototype
.
set
=
function
(
t
){
var
i
;
return
t
=
t
instanceof
Function
&&!
this
.
binder
[
"function"
]?
this
.
formattedValue
(
t
.
call
(
this
.
model
)):
this
.
formattedValue
(
t
),
null
!=
(
i
=
this
.
binder
.
routine
)?
i
.
call
(
this
,
this
.
el
,
t
):
void
0
},
n
.
prototype
.
sync
=
function
(){
return
this
.
set
(
this
.
options
.
bypass
?
this
.
model
[
this
.
keypath
]:
this
.
view
.
config
.
adapter
.
read
(
this
.
model
,
this
.
keypath
))},
n
.
prototype
.
publish
=
function
(){
var
i
,
n
,
s
,
r
,
o
,
h
,
l
,
u
,
a
;
for
(
r
=
t
.
Util
.
getInputValue
(
this
.
el
),
l
=
this
.
formatters
.
slice
(
0
).
reverse
(),
o
=
0
,
h
=
l
.
length
;
h
>
o
;
o
++
)
n
=
l
[
o
],
i
=
n
.
split
(
/
\s
+/
),
s
=
i
.
shift
(),(
null
!=
(
u
=
this
.
view
.
formatters
[
s
])?
u
.
publish
:
void
0
)
&&
(
r
=
(
a
=
this
.
view
.
formatters
[
s
]).
publish
.
apply
(
a
,[
r
].
concat
(
e
.
call
(
i
))));
return
this
.
view
.
config
.
adapter
.
publish
(
this
.
model
,
this
.
keypath
,
r
)},
n
.
prototype
.
bind
=
function
(){
var
t
,
i
,
e
,
n
,
s
,
r
,
o
,
h
,
l
;
if
(
null
!=
(
r
=
this
.
binder
.
bind
)
&&
r
.
call
(
this
,
this
.
el
),
this
.
options
.
bypass
?
this
.
sync
():(
this
.
view
.
config
.
adapter
.
subscribe
(
this
.
model
,
this
.
keypath
,
this
.
sync
),
this
.
view
.
config
.
preloadData
&&
this
.
sync
()),
null
!=
(
o
=
this
.
options
.
dependencies
)?
o
.
length
:
void
0
){
for
(
h
=
this
.
options
.
dependencies
,
l
=
[],
n
=
0
,
s
=
h
.
length
;
s
>
n
;
n
++
)
t
=
h
[
n
],
/^
\.
/
.
test
(
t
)?(
e
=
this
.
model
,
i
=
t
.
substr
(
1
)):(
t
=
t
.
split
(
"."
),
e
=
this
.
view
.
models
[
t
.
shift
()],
i
=
t
.
join
(
"."
)),
l
.
push
(
this
.
view
.
config
.
adapter
.
subscribe
(
e
,
i
,
this
.
sync
));
return
l
}},
n
.
prototype
.
unbind
=
function
(){
var
t
,
i
,
e
,
n
,
s
,
r
,
o
,
h
,
l
;
if
(
null
!=
(
r
=
this
.
binder
.
unbind
)
&&
r
.
call
(
this
,
this
.
el
),
this
.
options
.
bypass
||
this
.
view
.
config
.
adapter
.
unsubscribe
(
this
.
model
,
this
.
keypath
,
this
.
sync
),
null
!=
(
o
=
this
.
options
.
dependencies
)?
o
.
length
:
void
0
){
for
(
h
=
this
.
options
.
dependencies
,
l
=
[],
n
=
0
,
s
=
h
.
length
;
s
>
n
;
n
++
)
t
=
h
[
n
],
/^
\.
/
.
test
(
t
)?(
e
=
this
.
model
,
i
=
t
.
substr
(
1
)):(
t
=
t
.
split
(
"."
),
e
=
this
.
view
.
models
[
t
.
shift
()],
i
=
t
.
join
(
"."
)),
l
.
push
(
this
.
view
.
config
.
adapter
.
unsubscribe
(
e
,
i
,
this
.
sync
));
return
l
}},
n
.
prototype
.
update
=
function
(
t
){
var
i
;
return
null
==
t
&&
(
t
=
{}),
this
.
key
?
t
[
this
.
key
]
&&
(
this
.
options
.
bypass
||
this
.
view
.
config
.
adapter
.
unsubscribe
(
this
.
model
,
this
.
keypath
,
this
.
sync
),
this
.
model
=
t
[
this
.
key
],
this
.
options
.
bypass
?
this
.
sync
():(
this
.
view
.
config
.
adapter
.
subscribe
(
this
.
model
,
this
.
keypath
,
this
.
sync
),
this
.
view
.
config
.
preloadData
&&
this
.
sync
())):
this
.
sync
(),
null
!=
(
i
=
this
.
binder
.
update
)?
i
.
call
(
this
,
t
):
void
0
},
n
}(),
t
.
ComponentBinding
=
function
(
e
){
function
n
(
e
,
n
,
s
){
var
o
,
h
,
l
,
u
,
a
;
for
(
this
.
view
=
e
,
this
.
el
=
n
,
this
.
type
=
s
,
this
.
unbind
=
i
(
this
.
unbind
,
this
),
this
.
bind
=
i
(
this
.
bind
,
this
),
this
.
update
=
i
(
this
.
update
,
this
),
this
.
locals
=
i
(
this
.
locals
,
this
),
this
.
component
=
t
.
components
[
this
.
type
],
this
.
attributes
=
{},
this
.
inflections
=
{},
u
=
this
.
el
.
attributes
||
[],
h
=
0
,
l
=
u
.
length
;
l
>
h
;
h
++
)
o
=
u
[
h
],
a
=
o
.
name
,
r
.
call
(
this
.
component
.
attributes
,
a
)
>=
0
?
this
.
attributes
[
o
.
name
]
=
o
.
value
:
this
.
inflections
[
o
.
name
]
=
o
.
value
}
return
s
(
n
,
e
),
n
.
prototype
.
sync
=
function
(){},
n
.
prototype
.
locals
=
function
(
t
){
var
i
,
e
,
n
,
s
,
r
,
o
;
null
==
t
&&
(
t
=
this
.
view
.
models
),
s
=
{},
r
=
this
.
inflections
;
for
(
e
in
r
)
i
=
r
[
e
],
s
[
e
]
=
t
[
i
];
for
(
e
in
t
)
n
=
t
[
e
],
null
==
(
o
=
s
[
e
])
&&
(
s
[
e
]
=
n
);
return
s
},
n
.
prototype
.
update
=
function
(
t
){
var
i
;
return
null
!=
(
i
=
this
.
componentView
)?
i
.
update
(
this
.
locals
(
t
)):
void
0
},
n
.
prototype
.
bind
=
function
(){
var
i
,
e
;
return
null
!=
this
.
componentView
?
null
!=
(
e
=
this
.
componentView
)?
e
.
bind
():
void
0
:(
i
=
this
.
component
.
build
.
call
(
this
.
attributes
),(
this
.
componentView
=
new
t
.
View
(
i
,
this
.
locals
(),
this
.
view
.
options
)).
bind
(),
this
.
el
.
parentNode
.
replaceChild
(
i
,
this
.
el
))},
n
.
prototype
.
unbind
=
function
(){
var
t
;
return
null
!=
(
t
=
this
.
componentView
)?
t
.
unbind
():
void
0
},
n
}(
t
.
Binding
),
t
.
View
=
function
(){
function
n
(
e
,
n
,
s
){
var
r
,
o
,
h
,
l
,
u
,
a
,
d
,
p
,
c
,
f
;
for
(
this
.
els
=
e
,
this
.
models
=
n
,
this
.
options
=
null
!=
s
?
s
:{},
this
.
update
=
i
(
this
.
update
,
this
),
this
.
publish
=
i
(
this
.
publish
,
this
),
this
.
sync
=
i
(
this
.
sync
,
this
),
this
.
unbind
=
i
(
this
.
unbind
,
this
),
this
.
bind
=
i
(
this
.
bind
,
this
),
this
.
select
=
i
(
this
.
select
,
this
),
this
.
build
=
i
(
this
.
build
,
this
),
this
.
componentRegExp
=
i
(
this
.
componentRegExp
,
this
),
this
.
bindingRegExp
=
i
(
this
.
bindingRegExp
,
this
),
this
.
els
.
jquery
||
this
.
els
instanceof
Array
||
(
this
.
els
=
[
this
.
els
]),
d
=
[
"config"
,
"binders"
,
"formatters"
],
u
=
0
,
a
=
d
.
length
;
a
>
u
;
u
++
){
if
(
o
=
d
[
u
],
this
[
o
]
=
{},
this
.
options
[
o
]){
p
=
this
.
options
[
o
];
for
(
r
in
p
)
h
=
p
[
r
],
this
[
o
][
r
]
=
h
}
c
=
t
[
o
];
for
(
r
in
c
)
h
=
c
[
r
],
null
==
(
f
=
(
l
=
this
[
o
])[
r
])
&&
(
l
[
r
]
=
h
)}
this
.
build
()}
return
n
.
prototype
.
bindingRegExp
=
function
(){
var
t
;
return
t
=
this
.
config
.
prefix
,
t
?
RegExp
(
"^data-"
+
t
+
"-"
):
/^data-/
},
n
.
prototype
.
componentRegExp
=
function
(){
var
t
,
i
;
return
RegExp
(
"^"
+
(
null
!=
(
t
=
null
!=
(
i
=
this
.
config
.
prefix
)?
i
.
toUpperCase
():
void
0
)?
t
:
"RV"
)
+
"-"
)},
n
.
prototype
.
build
=
function
(){
var
i
,
n
,
s
,
o
,
h
,
l
,
u
,
a
,
d
,
p
=
this
;
for
(
this
.
bindings
=
[],
l
=
[],
i
=
this
.
bindingRegExp
(),
s
=
this
.
componentRegExp
(),
n
=
function
(
i
,
e
,
n
){
var
s
,
r
,
o
,
h
,
l
,
u
,
a
,
d
,
c
,
f
;
return
u
=
{},
c
=
function
(){
var
t
,
i
,
e
,
s
;
for
(
e
=
n
.
split
(
"|"
),
s
=
[],
t
=
0
,
i
=
e
.
length
;
i
>
t
;
t
++
)
d
=
e
[
t
],
s
.
push
(
d
.
trim
());
return
s
}(),
s
=
function
(){
var
t
,
i
,
e
,
n
;
for
(
e
=
c
.
shift
().
split
(
"<"
),
n
=
[],
t
=
0
,
i
=
e
.
length
;
i
>
t
;
t
++
)
r
=
e
[
t
],
n
.
push
(
r
.
trim
());
return
n
}(),
a
=
s
.
shift
(),
f
=
a
.
split
(
/
\.
|:/
),
u
.
formatters
=
c
,
u
.
bypass
=-
1
!==
a
.
indexOf
(
":"
),
f
[
0
]?
h
=
f
.
shift
():(
h
=
null
,
f
.
shift
()),
l
=
f
.
join
(
"."
),(
o
=
s
.
shift
())
&&
(
u
.
dependencies
=
o
.
split
(
/
\s
+/
)),
p
.
bindings
.
push
(
new
t
.
Binding
(
p
,
i
,
e
,
h
,
l
,
u
))},
h
=
function
(
o
){
var
u
,
a
,
d
,
c
,
f
,
b
,
v
,
g
,
y
,
m
,
w
,
x
,
k
,
E
,
N
,
V
,
j
,
R
,
C
,
U
,
B
,
T
,
O
,
Q
,
A
,
D
,
L
,
_
,
F
,
H
,
S
,
$
;
if
(
0
>
r
.
call
(
l
,
o
)){
if
(
o
.
nodeType
===
Node
.
TEXT_NODE
){
if
(
g
=
t
.
TextTemplateParser
,(
f
=
p
.
config
.
templateDelimiters
)
&&
(
E
=
g
.
parse
(
o
.
data
,
f
)).
length
&&
(
1
!==
E
.
length
||
E
[
0
].
type
!==
g
.
types
.
text
)){
switch
(
w
=
E
[
0
],
m
=
E
.
length
>=
2
?
e
.
call
(
E
,
1
):[],
o
.
data
=
w
.
value
,
w
.
type
){
case
0
:
o
.
data
=
w
.
value
;
break
;
case
1
:
n
(
o
,
"textNode"
,
w
.
value
)}
for
(
j
=
0
,
B
=
m
.
length
;
B
>
j
;
j
++
)
k
=
m
[
j
],
o
.
parentNode
.
appendChild
(
x
=
document
.
createTextNode
(
k
.
value
)),
1
===
k
.
type
&&
n
(
x
,
"textNode"
,
k
.
value
)}}
else
if
(
s
.
test
(
o
.
tagName
))
N
=
o
.
tagName
.
replace
(
s
,
""
).
toLowerCase
(),
p
.
bindings
.
push
(
new
t
.
ComponentBinding
(
p
,
o
,
N
));
else
if
(
null
!=
o
.
attributes
){
for
(
L
=
o
.
attributes
,
R
=
0
,
T
=
L
.
length
;
T
>
R
;
R
++
)
if
(
u
=
L
[
R
],
i
.
test
(
u
.
name
)){
if
(
N
=
u
.
name
.
replace
(
i
,
""
),
!
(
d
=
p
.
binders
[
N
])){
_
=
p
.
binders
;
for
(
b
in
_
)
V
=
_
[
b
],
"*"
!==
b
&&-
1
!==
b
.
indexOf
(
"*"
)
&&
(
y
=
RegExp
(
"^"
+
b
.
replace
(
"*"
,
".+"
)
+
"$"
),
y
.
test
(
N
)
&&
(
d
=
V
))}
if
(
d
||
(
d
=
p
.
binders
[
"*"
]),
d
.
block
){
for
(
F
=
o
.
childNodes
,
C
=
0
,
O
=
F
.
length
;
O
>
C
;
C
++
)
v
=
F
[
C
],
l
.
push
(
v
);
a
=
[
u
]}}
for
(
H
=
a
||
o
.
attributes
,
U
=
0
,
Q
=
H
.
length
;
Q
>
U
;
U
++
)
u
=
H
[
U
],
i
.
test
(
u
.
name
)
&&
(
N
=
u
.
name
.
replace
(
i
,
""
),
n
(
o
,
N
,
u
.
value
))}
for
(
S
=
o
.
childNodes
,
$
=
[],
D
=
0
,
A
=
S
.
length
;
A
>
D
;
D
++
)
c
=
S
[
D
],
$
.
push
(
h
(
c
));
return
$
}},
d
=
this
.
els
,
u
=
0
,
a
=
d
.
length
;
a
>
u
;
u
++
)
o
=
d
[
u
],
h
(
o
)},
n
.
prototype
.
select
=
function
(
t
){
var
i
,
e
,
n
,
s
,
r
;
for
(
s
=
this
.
bindings
,
r
=
[],
e
=
0
,
n
=
s
.
length
;
n
>
e
;
e
++
)
i
=
s
[
e
],
t
(
i
)
&&
r
.
push
(
i
);
return
r
},
n
.
prototype
.
bind
=
function
(){
var
t
,
i
,
e
,
n
,
s
;
for
(
n
=
this
.
bindings
,
s
=
[],
i
=
0
,
e
=
n
.
length
;
e
>
i
;
i
++
)
t
=
n
[
i
],
s
.
push
(
t
.
bind
());
return
s
},
n
.
prototype
.
unbind
=
function
(){
var
t
,
i
,
e
,
n
,
s
;
for
(
n
=
this
.
bindings
,
s
=
[],
i
=
0
,
e
=
n
.
length
;
e
>
i
;
i
++
)
t
=
n
[
i
],
s
.
push
(
t
.
unbind
());
return
s
},
n
.
prototype
.
sync
=
function
(){
var
t
,
i
,
e
,
n
,
s
;
for
(
n
=
this
.
bindings
,
s
=
[],
i
=
0
,
e
=
n
.
length
;
e
>
i
;
i
++
)
t
=
n
[
i
],
s
.
push
(
t
.
sync
());
return
s
},
n
.
prototype
.
publish
=
function
(){
var
t
,
i
,
e
,
n
,
s
;
for
(
n
=
this
.
select
(
function
(
t
){
return
t
.
binder
.
publishes
}),
s
=
[],
i
=
0
,
e
=
n
.
length
;
e
>
i
;
i
++
)
t
=
n
[
i
],
s
.
push
(
t
.
publish
());
return
s
},
n
.
prototype
.
update
=
function
(
t
){
var
i
,
e
,
n
,
s
,
r
,
o
,
h
;
null
==
t
&&
(
t
=
{});
for
(
e
in
t
)
n
=
t
[
e
],
this
.
models
[
e
]
=
n
;
for
(
o
=
this
.
bindings
,
h
=
[],
s
=
0
,
r
=
o
.
length
;
r
>
s
;
s
++
)
i
=
o
[
s
],
h
.
push
(
i
.
update
(
t
));
return
h
},
n
}(),
t
.
TextTemplateParser
=
function
(){
function
t
(){}
return
t
.
types
=
{
text
:
0
,
binding
:
1
},
t
.
parse
=
function
(
t
,
i
){
var
e
,
n
,
s
,
r
,
o
,
h
,
l
;
for
(
h
=
[],
r
=
t
.
length
,
e
=
0
,
n
=
0
;
r
>
n
;){
if
(
e
=
t
.
indexOf
(
i
[
0
],
n
),
0
>
e
){
h
.
push
({
type
:
this
.
types
.
text
,
value
:
t
.
slice
(
n
)});
break
}
if
(
e
>
0
&&
e
>
n
&&
h
.
push
({
type
:
this
.
types
.
text
,
value
:
t
.
slice
(
n
,
e
)}),
n
=
e
+
2
,
e
=
t
.
indexOf
(
i
[
1
],
n
),
0
>
e
){
o
=
t
.
slice
(
n
-
2
),
s
=
h
[
h
.
length
-
1
],(
null
!=
s
?
s
.
type
:
void
0
)
===
this
.
types
.
text
?
s
.
value
+=
o
:
h
.
push
({
type
:
this
.
types
.
text
,
value
:
o
});
break
}
l
=
t
.
slice
(
n
,
e
).
trim
(),
h
.
push
({
type
:
this
.
types
.
binding
,
value
:
l
}),
n
=
e
+
2
}
return
h
},
t
}(),
t
.
Util
=
{
bindEvent
:
function
(
t
,
i
,
e
){
return
null
!=
window
.
jQuery
?(
t
=
jQuery
(
t
),
null
!=
t
.
on
?
t
.
on
(
i
,
e
):
t
.
bind
(
i
,
e
)):
null
!=
window
.
addEventListener
?
t
.
addEventListener
(
i
,
e
,
!
1
):(
i
=
"on"
+
i
,
t
.
attachEvent
(
i
,
e
))},
unbindEvent
:
function
(
t
,
i
,
e
){
return
null
!=
window
.
jQuery
?(
t
=
jQuery
(
t
),
null
!=
t
.
off
?
t
.
off
(
i
,
e
):
t
.
unbind
(
i
,
e
)):
null
!=
window
.
removeEventListener
?
t
.
removeEventListener
(
i
,
e
,
!
1
):(
i
=
"on"
+
i
,
t
.
detachEvent
(
i
,
e
))},
getInputValue
:
function
(
t
){
var
i
,
e
,
n
,
s
;
if
(
null
!=
window
.
jQuery
)
switch
(
t
=
jQuery
(
t
),
t
[
0
].
type
){
case
"checkbox"
:
return
t
.
is
(
":checked"
);
default
:
return
t
.
val
()}
else
switch
(
t
.
type
){
case
"checkbox"
:
return
t
.
checked
;
case
"select-multiple"
:
for
(
s
=
[],
e
=
0
,
n
=
t
.
length
;
n
>
e
;
e
++
)
i
=
t
[
e
],
i
.
selected
&&
s
.
push
(
i
.
value
);
return
s
;
default
:
return
t
.
value
}}},
t
.
binders
=
{
enabled
:
function
(
t
,
i
){
return
t
.
disabled
=!
i
},
disabled
:
function
(
t
,
i
){
return
t
.
disabled
=!!
i
},
checked
:{
publishes
:
!
0
,
bind
:
function
(
i
){
return
t
.
Util
.
bindEvent
(
i
,
"change"
,
this
.
publish
)},
unbind
:
function
(
i
){
return
t
.
Util
.
unbindEvent
(
i
,
"change"
,
this
.
publish
)},
routine
:
function
(
t
,
i
){
var
e
;
return
t
.
checked
=
"radio"
===
t
.
type
?(
null
!=
(
e
=
t
.
value
)?
""
+
e
:
void
0
)
===
(
null
!=
i
?
""
+
i
:
void
0
):
!!
i
}},
unchecked
:{
publishes
:
!
0
,
bind
:
function
(
i
){
return
t
.
Util
.
bindEvent
(
i
,
"change"
,
this
.
publish
)},
unbind
:
function
(
i
){
return
t
.
Util
.
unbindEvent
(
i
,
"change"
,
this
.
publish
)},
routine
:
function
(
t
,
i
){
var
e
;
return
t
.
checked
=
"radio"
===
t
.
type
?(
null
!=
(
e
=
t
.
value
)?
""
+
e
:
void
0
)
!==
(
null
!=
i
?
""
+
i
:
void
0
):
!
i
}},
show
:
function
(
t
,
i
){
return
t
.
style
.
display
=
i
?
""
:
"none"
},
hide
:
function
(
t
,
i
){
return
t
.
style
.
display
=
i
?
"none"
:
""
},
html
:
function
(
t
,
i
){
return
t
.
innerHTML
=
null
!=
i
?
i
:
""
},
value
:{
publishes
:
!
0
,
bind
:
function
(
i
){
return
t
.
Util
.
bindEvent
(
i
,
"change"
,
this
.
publish
)},
unbind
:
function
(
i
){
return
t
.
Util
.
unbindEvent
(
i
,
"change"
,
this
.
publish
)},
routine
:
function
(
t
,
i
){
var
e
,
n
,
s
,
o
,
h
,
l
,
u
;
if
(
null
!=
window
.
jQuery
){
if
(
t
=
jQuery
(
t
),(
null
!=
i
?
""
+
i
:
void
0
)
!==
(
null
!=
(
o
=
t
.
val
())?
""
+
o
:
void
0
))
return
t
.
val
(
null
!=
i
?
i
:
""
)}
else
if
(
"select-multiple"
===
t
.
type
){
if
(
null
!=
i
){
for
(
u
=
[],
n
=
0
,
s
=
t
.
length
;
s
>
n
;
n
++
)
e
=
t
[
n
],
u
.
push
(
e
.
selected
=
(
h
=
e
.
value
,
r
.
call
(
i
,
h
)
>=
0
));
return
u
}}
else
if
((
null
!=
i
?
""
+
i
:
void
0
)
!==
(
null
!=
(
l
=
t
.
value
)?
""
+
l
:
void
0
))
return
t
.
value
=
null
!=
i
?
i
:
""
}},
text
:
function
(
t
,
i
){
return
null
!=
t
.
innerText
?
t
.
innerText
=
null
!=
i
?
i
:
""
:
t
.
textContent
=
null
!=
i
?
i
:
""
},
"if"
:{
block
:
!
0
,
bind
:
function
(
t
){
var
i
,
e
;
return
null
==
this
.
marker
?(
i
=
[
"data"
,
this
.
view
.
config
.
prefix
,
this
.
type
].
join
(
"-"
).
replace
(
"--"
,
"-"
),
e
=
t
.
getAttribute
(
i
),
this
.
marker
=
document
.
createComment
(
" rivets: "
+
this
.
type
+
" "
+
e
+
" "
),
t
.
removeAttribute
(
i
),
t
.
parentNode
.
insertBefore
(
this
.
marker
,
t
),
t
.
parentNode
.
removeChild
(
t
)):
void
0
},
unbind
:
function
(){
var
t
;
return
null
!=
(
t
=
this
.
nested
)?
t
.
unbind
():
void
0
},
routine
:
function
(
i
,
e
){
var
n
,
s
,
r
,
o
,
h
;
if
(
!!
e
==
(
null
==
this
.
nested
)){
if
(
e
){
r
=
{},
h
=
this
.
view
.
models
;
for
(
n
in
h
)
s
=
h
[
n
],
r
[
n
]
=
s
;
return
o
=
{
binders
:
this
.
view
.
options
.
binders
,
formatters
:
this
.
view
.
options
.
formatters
,
config
:
this
.
view
.
options
.
config
},(
this
.
nested
=
new
t
.
View
(
i
,
r
,
o
)).
bind
(),
this
.
marker
.
parentNode
.
insertBefore
(
i
,
this
.
marker
.
nextSibling
)}
return
i
.
parentNode
.
removeChild
(
i
),
this
.
nested
.
unbind
(),
delete
this
.
nested
}},
update
:
function
(
t
){
return
this
.
nested
.
update
(
t
)}},
unless
:{
block
:
!
0
,
bind
:
function
(
i
){
return
t
.
binders
[
"if"
].
bind
.
call
(
this
,
i
)},
unbind
:
function
(){
return
t
.
binders
[
"if"
].
unbind
.
call
(
this
)},
routine
:
function
(
i
,
e
){
return
t
.
binders
[
"if"
].
routine
.
call
(
this
,
i
,
!
e
)},
update
:
function
(
i
){
return
t
.
binders
[
"if"
].
update
.
call
(
this
,
i
)}},
"on-*"
:{
"function"
:
!
0
,
unbind
:
function
(
i
){
return
this
.
handler
?
t
.
Util
.
unbindEvent
(
i
,
this
.
args
[
0
],
this
.
handler
):
void
0
},
routine
:
function
(
i
,
e
){
return
this
.
handler
&&
t
.
Util
.
unbindEvent
(
i
,
this
.
args
[
0
],
this
.
handler
),
t
.
Util
.
bindEvent
(
i
,
this
.
args
[
0
],
this
.
handler
=
this
.
eventHandler
(
e
))}},
"each-*"
:{
block
:
!
0
,
bind
:
function
(
t
){
var
i
;
return
null
==
this
.
marker
?(
i
=
[
"data"
,
this
.
view
.
config
.
prefix
,
this
.
type
].
join
(
"-"
).
replace
(
"--"
,
"-"
),
this
.
marker
=
document
.
createComment
(
" rivets: "
+
this
.
type
+
" "
),
this
.
iterated
=
[],
t
.
removeAttribute
(
i
),
t
.
parentNode
.
insertBefore
(
this
.
marker
,
t
),
t
.
parentNode
.
removeChild
(
t
)):
void
0
},
unbind
:
function
(){
var
t
,
i
,
e
,
n
,
s
;
if
(
null
!=
this
.
iterated
){
for
(
n
=
this
.
iterated
,
s
=
[],
i
=
0
,
e
=
n
.
length
;
e
>
i
;
i
++
)
t
=
n
[
i
],
s
.
push
(
t
.
unbind
());
return
s
}},
routine
:
function
(
i
,
e
){
var
n
,
s
,
r
,
o
,
h
,
l
,
u
,
a
,
d
,
p
,
c
,
f
,
b
,
v
,
g
,
y
,
m
,
w
,
x
,
k
,
E
;
if
(
u
=
this
.
args
[
0
],
e
=
e
||
[],
this
.
iterated
.
length
>
e
.
length
)
for
(
m
=
Array
(
this
.
iterated
.
length
-
e
.
length
),
b
=
0
,
g
=
m
.
length
;
g
>
b
;
b
++
)
s
=
m
[
b
],
f
=
this
.
iterated
.
pop
(),
f
.
unbind
(),
this
.
marker
.
parentNode
.
removeChild
(
f
.
els
[
0
]);
for
(
E
=
[],
r
=
v
=
0
,
y
=
e
.
length
;
y
>
v
;
r
=++
v
)
if
(
l
=
e
[
r
],
n
=
{},
n
[
u
]
=
l
,
null
==
this
.
iterated
[
r
]){
w
=
this
.
view
.
models
;
for
(
h
in
w
)
l
=
w
[
h
],
null
==
(
x
=
n
[
h
])
&&
(
n
[
h
]
=
l
);
d
=
this
.
iterated
.
length
?
this
.
iterated
[
this
.
iterated
.
length
-
1
].
els
[
0
]:
this
.
marker
,
a
=
{
binders
:
this
.
view
.
options
.
binders
,
formatters
:
this
.
view
.
options
.
formatters
,
config
:{}},
k
=
this
.
view
.
options
.
config
;
for
(
o
in
k
)
c
=
k
[
o
],
a
.
config
[
o
]
=
c
;
a
.
config
.
preloadData
=!
0
,
p
=
i
.
cloneNode
(
!
0
),
f
=
new
t
.
View
(
p
,
n
,
a
),
f
.
bind
(),
this
.
iterated
.
push
(
f
),
E
.
push
(
this
.
marker
.
parentNode
.
insertBefore
(
p
,
d
.
nextSibling
))}
else
this
.
iterated
[
r
].
models
[
u
]
!==
l
?
E
.
push
(
this
.
iterated
[
r
].
update
(
n
)):
E
.
push
(
void
0
);
return
E
},
update
:
function
(
t
){
var
i
,
e
,
n
,
s
,
r
,
o
,
h
,
l
;
i
=
{};
for
(
e
in
t
)
n
=
t
[
e
],
e
!==
this
.
args
[
0
]
&&
(
i
[
e
]
=
n
);
for
(
h
=
this
.
iterated
,
l
=
[],
r
=
0
,
o
=
h
.
length
;
o
>
r
;
r
++
)
s
=
h
[
r
],
l
.
push
(
s
.
update
(
i
));
return
l
}},
"class-*"
:
function
(
t
,
i
){
var
e
;
return
e
=
" "
+
t
.
className
+
" "
,
!
i
==
(
-
1
!==
e
.
indexOf
(
" "
+
this
.
args
[
0
]
+
" "
))?
t
.
className
=
i
?
""
+
t
.
className
+
" "
+
this
.
args
[
0
]:
e
.
replace
(
" "
+
this
.
args
[
0
]
+
" "
,
" "
).
trim
():
void
0
},
"*"
:
function
(
t
,
i
){
return
i
?
t
.
setAttribute
(
this
.
type
,
i
):
t
.
removeAttribute
(
this
.
type
)}},
t
.
internalBinders
=
{
textNode
:
function
(
t
,
i
){
return
t
.
data
=
null
!=
i
?
i
:
""
}},
t
.
components
=
{},
t
.
config
=
{
preloadData
:
!
0
,
handler
:
function
(
t
,
i
,
e
){
return
this
.
call
(
t
,
i
,
e
.
view
.
models
)}},
t
.
formatters
=
{},
t
.
factory
=
function
(
i
){
return
i
.
_
=
t
,
i
.
binders
=
t
.
binders
,
i
.
components
=
t
.
components
,
i
.
formatters
=
t
.
formatters
,
i
.
config
=
t
.
config
,
i
.
configure
=
function
(
i
){
var
e
,
n
;
null
==
i
&&
(
i
=
{});
for
(
e
in
i
)
n
=
i
[
e
],
t
.
config
[
e
]
=
n
},
i
.
bind
=
function
(
i
,
e
,
n
){
var
s
;
return
null
==
e
&&
(
e
=
{}),
null
==
n
&&
(
n
=
{}),
s
=
new
t
.
View
(
i
,
e
,
n
),
s
.
bind
(),
s
}},
"object"
==
typeof
exports
?
t
.
factory
(
exports
):
"function"
==
typeof
define
&&
define
.
amd
?
define
([
"exports"
],
function
(
i
){
return
t
.
factory
(
this
.
rivets
=
i
),
i
}):
t
.
factory
(
this
.
rivets
=
{})}).
call
(
this
);
\ No newline at end of file
...
...
package.json
View file @
20ce959
{
"name"
:
"rivets"
,
"description"
:
"Declarative data binding facility."
,
"version"
:
"0.5.
9
"
,
"version"
:
"0.5.
10
"
,
"author"
:
"Michael Richards"
,
"url"
:
"http://rivetsjs.com"
,
"main"
:
"./dist/rivets.js"
,
...
...
src/rivets.coffee
View file @
20ce959
# Rivets.js
# =========
# > version: 0.5.
9
# > version: 0.5.
10
# > author: Michael Richards
# > license: MIT
# >
...
...
Please
register
or
sign in
to post a comment