Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
todomvc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Eugene Shen
todomvc
Commits
7c70864f
Commit
7c70864f
authored
Jun 06, 2011
by
addyosmani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
patching issue with KnockoutJS not correctly observing values added when using Opera
parent
5120ff3b
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
838 additions
and
669 deletions
+838
-669
todo-example/backbone/css/todos.css
todo-example/backbone/css/todos.css
+400
-400
todo-example/knockoutjs/css/todos.css
todo-example/knockoutjs/css/todos.css
+351
-267
todo-example/knockoutjs/index.html
todo-example/knockoutjs/index.html
+11
-2
todo-example/knockoutjs/js/knockout-1.2.1.js
todo-example/knockoutjs/js/knockout-1.2.1.js
+76
-0
No files found.
todo-example/backbone/css/todos.css
View file @
7c70864f
...
...
@@ -31,13 +31,13 @@ a img {
html
{
background
:
#eeeeee
;
}
body
{
body
{
font-family
:
"Helvetica Neue"
,
Helvetica
,
Arial
,
sans-serif
;
font-size
:
14px
;
line-height
:
1.4em
;
background
:
#eeeeee
;
color
:
#333333
;
}
}
#todoapp
{
width
:
480px
;
...
...
@@ -49,18 +49,18 @@ html {
-o-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
5px
6px
0
;
box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
5px
6px
0
;
}
#todoapp
h1
{
#todoapp
h1
{
font-size
:
36px
;
font-weight
:
bold
;
text-align
:
center
;
padding
:
20px
0
30px
0
;
line-height
:
1
;
}
}
#create-todo
{
position
:
relative
;
}
#create-todo
input
{
#create-todo
input
{
width
:
466px
;
font-size
:
24px
;
font-family
:
inherit
;
...
...
@@ -73,46 +73,46 @@ html {
-webkit-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
1px
2px
0
inset
;
-o-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
1px
2px
0
inset
;
box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
1px
2px
0
inset
;
}
}
#create-todo
span
{
#create-todo
span
{
position
:
absolute
;
z-index
:
999
;
width
:
170px
;
left
:
50%
;
margin-left
:
-85px
;
}
}
#todo-list
{
margin-top
:
10px
;
}
#todo-list
li
{
#todo-list
li
{
padding
:
12px
20px
11px
0
;
position
:
relative
;
font-size
:
24px
;
line-height
:
1.1em
;
border-bottom
:
1px
solid
#cccccc
;
}
#todo-list
li
:after
{
}
#todo-list
li
:after
{
content
:
"\0020"
;
display
:
block
;
height
:
0
;
clear
:
both
;
overflow
:
hidden
;
visibility
:
hidden
;
}
#todo-list
li
.editing
{
}
#todo-list
li
.editing
{
padding
:
0
;
border-bottom
:
0
;
}
#todo-list
.editing
.display
,
#todo-list
.edit
{
}
#todo-list
.editing
.display
,
#todo-list
.edit
{
display
:
none
;
}
#todo-list
.editing
.edit
{
}
#todo-list
.editing
.edit
{
display
:
block
;
}
#todo-list
.editing
input
{
}
#todo-list
.editing
input
{
width
:
444px
;
font-size
:
24px
;
font-family
:
inherit
;
...
...
@@ -126,18 +126,18 @@ html {
-webkit-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
1px
2px
0
inset
;
-o-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
1px
2px
0
inset
;
box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
1px
2px
0
inset
;
}
#todo-list
.check
{
}
#todo-list
.check
{
position
:
relative
;
top
:
9px
;
margin
:
0
10px
0
7px
;
float
:
left
;
}
#todo-list
.done
.todo-content
{
}
#todo-list
.done
.todo-content
{
text-decoration
:
line-through
;
color
:
#777777
;
}
#todo-list
.todo-destroy
{
}
#todo-list
.todo-destroy
{
position
:
absolute
;
right
:
5px
;
top
:
14px
;
...
...
@@ -146,47 +146,47 @@ html {
width
:
20px
;
height
:
20px
;
background
:
url(destroy.png)
no-repeat
0
0
;
}
#todo-list
li
:hover
.todo-destroy
{
}
#todo-list
li
:hover
.todo-destroy
{
display
:
block
;
}
#todo-list
.todo-destroy
:hover
{
}
#todo-list
.todo-destroy
:hover
{
background-position
:
0
-20px
;
}
}
#todo-stats
{
*
zoom
:
1
;
margin-top
:
10px
;
color
:
#777777
;
}
#todo-stats
:after
{
#todo-stats
:after
{
content
:
"\0020"
;
display
:
block
;
height
:
0
;
clear
:
both
;
overflow
:
hidden
;
visibility
:
hidden
;
}
#todo-stats
.todo-count
{
}
#todo-stats
.todo-count
{
float
:
left
;
}
#todo-stats
.todo-count
.number
{
}
#todo-stats
.todo-count
.number
{
font-weight
:
bold
;
color
:
#333333
;
}
#todo-stats
.todo-clear
{
}
#todo-stats
.todo-clear
{
float
:
right
;
}
#todo-stats
.todo-clear
a
{
}
#todo-stats
.todo-clear
a
{
color
:
#777777
;
font-size
:
12px
;
}
#todo-stats
.todo-clear
a
:visited
{
}
#todo-stats
.todo-clear
a
:visited
{
color
:
#777777
;
}
#todo-stats
.todo-clear
a
:hover
{
}
#todo-stats
.todo-clear
a
:hover
{
color
:
#336699
;
}
}
#instructions
{
width
:
520px
;
...
...
@@ -195,9 +195,9 @@ html {
text-shadow
:
rgba
(
255
,
255
,
255
,
0.8
)
0
1px
0
;
text-align
:
center
;
}
#instructions
a
{
#instructions
a
{
color
:
#336699
;
}
}
#credits
{
width
:
520px
;
...
...
@@ -206,14 +206,14 @@ html {
text-shadow
:
rgba
(
255
,
255
,
255
,
0.8
)
0
1px
0
;
text-align
:
center
;
}
#credits
a
{
#credits
a
{
color
:
#888
;
}
}
/*
* François 'cahnory' Germain
*/
* François 'cahnory' Germain
*/
.ui-tooltip
,
.ui-tooltip-top
,
.ui-tooltip-right
,
.ui-tooltip-bottom
,
.ui-tooltip-left
{
color
:
#ffffff
;
cursor
:
normal
;
...
...
todo-example/knockoutjs/css/todos.css
View file @
7c70864f
...
...
@@ -31,13 +31,13 @@ a img {
html
{
background
:
#eeeeee
;
}
body
{
body
{
font-family
:
"Helvetica Neue"
,
Helvetica
,
Arial
,
sans-serif
;
font-size
:
14px
;
line-height
:
1.4em
;
background
:
#eeeeee
;
color
:
#333333
;
}
}
#todoapp
{
width
:
480px
;
...
...
@@ -49,18 +49,18 @@ html {
-o-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
5px
6px
0
;
box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
5px
6px
0
;
}
#todoapp
h1
{
#todoapp
h1
{
font-size
:
36px
;
font-weight
:
bold
;
text-align
:
center
;
padding
:
20px
0
30px
0
;
line-height
:
1
;
}
}
#create-todo
{
position
:
relative
;
}
#create-todo
input
{
#create-todo
input
{
width
:
466px
;
font-size
:
24px
;
font-family
:
inherit
;
...
...
@@ -73,48 +73,48 @@ html {
-webkit-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
1px
2px
0
inset
;
-o-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
1px
2px
0
inset
;
box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
1px
2px
0
inset
;
}
#create-todo
input
::-webkit-input-placeholder
{
}
#create-todo
input
::-webkit-input-placeholder
{
font-style
:
italic
;
}
#create-todo
span
{
}
#create-todo
span
{
position
:
absolute
;
z-index
:
999
;
width
:
170px
;
left
:
50%
;
margin-left
:
-85px
;
}
}
#todo-list
{
margin-top
:
10px
;
}
#todo-list
li
{
#todo-list
li
{
padding
:
12px
20px
11px
0
;
position
:
relative
;
font-size
:
24px
;
line-height
:
1.1em
;
border-bottom
:
1px
solid
#cccccc
;
}
#todo-list
li
:after
{
}
#todo-list
li
:after
{
content
:
"\0020"
;
display
:
block
;
height
:
0
;
clear
:
both
;
overflow
:
hidden
;
visibility
:
hidden
;
}
#todo-list
li
.editing
{
}
#todo-list
li
.editing
{
padding
:
0
;
border-bottom
:
0
;
}
#todo-list
.editing
.display
,
#todo-list
.edit
{
}
#todo-list
.editing
.display
,
#todo-list
.edit
{
display
:
none
;
}
#todo-list
.editing
.edit
{
}
#todo-list
.editing
.edit
{
display
:
block
;
}
#todo-list
.editing
input
{
}
#todo-list
.editing
input
{
width
:
444px
;
font-size
:
24px
;
font-family
:
inherit
;
...
...
@@ -128,18 +128,18 @@ html {
-webkit-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
1px
2px
0
inset
;
-o-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
1px
2px
0
inset
;
box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
1px
2px
0
inset
;
}
#todo-list
.check
{
}
#todo-list
.check
{
position
:
relative
;
top
:
9px
;
margin
:
0
10px
0
7px
;
float
:
left
;
}
#todo-list
.done
.todo-content
{
}
#todo-list
.done
.todo-content
{
text-decoration
:
line-through
;
color
:
#777777
;
}
#todo-list
.todo-destroy
{
}
#todo-list
.todo-destroy
{
position
:
absolute
;
right
:
5px
;
top
:
14px
;
...
...
@@ -148,47 +148,47 @@ html {
width
:
20px
;
height
:
20px
;
background
:
url(destroy.png)
no-repeat
0
0
;
}
#todo-list
li
:hover
.todo-destroy
{
}
#todo-list
li
:hover
.todo-destroy
{
display
:
block
;
}
#todo-list
.todo-destroy
:hover
{
}
#todo-list
.todo-destroy
:hover
{
background-position
:
0
-20px
;
}
}
#todo-stats
{
*
zoom
:
1
;
margin-top
:
10px
;
color
:
#777777
;
}
#todo-stats
:after
{
#todo-stats
:after
{
content
:
"\0020"
;
display
:
block
;
height
:
0
;
clear
:
both
;
overflow
:
hidden
;
visibility
:
hidden
;
}
#todo-stats
.todo-count
{
}
#todo-stats
.todo-count
{
float
:
left
;
}
#todo-stats
.todo-count
.number
{
}
#todo-stats
.todo-count
.number
{
font-weight
:
bold
;
color
:
#333333
;
}
#todo-stats
.todo-clear
{
}
#todo-stats
.todo-clear
{
float
:
right
;
}
#todo-stats
.todo-clear
a
{
}
#todo-stats
.todo-clear
a
{
color
:
#777777
;
font-size
:
12px
;
}
#todo-stats
.todo-clear
a
:visited
{
}
#todo-stats
.todo-clear
a
:visited
{
color
:
#777777
;
}
#todo-stats
.todo-clear
a
:hover
{
}
#todo-stats
.todo-clear
a
:hover
{
color
:
#336699
;
}
}
#instructions
{
width
:
520px
;
...
...
@@ -197,9 +197,9 @@ html {
text-shadow
:
rgba
(
255
,
255
,
255
,
0.8
)
0
1px
0
;
text-align
:
center
;
}
#instructions
a
{
#instructions
a
{
color
:
#336699
;
}
}
#credits
{
width
:
520px
;
...
...
@@ -208,14 +208,14 @@ html {
text-shadow
:
rgba
(
255
,
255
,
255
,
0.8
)
0
1px
0
;
text-align
:
center
;
}
#credits
a
{
#credits
a
{
color
:
#888
;
}
}
/*
* François 'cahnory' Germain
*/
* François 'cahnory' Germain
*/
.ui-tooltip
,
.ui-tooltip-top
,
.ui-tooltip-right
,
.ui-tooltip-bottom
,
.ui-tooltip-left
{
color
:
#ffffff
;
cursor
:
normal
;
...
...
@@ -309,3 +309,87 @@ html {
-khtml-transform
:
rotate
(
180deg
);
-webkit-transform
:
rotate
(
180deg
);
}
/* new additions - cleanup required*/
/* line 109 */
#todoapp
#todo-stats
{
*
zoom
:
1
;
margin-top
:
10px
;
color
:
#555555
;
-moz-border-radius-bottomleft
:
5px
;
-webkit-border-bottom-left-radius
:
5px
;
-o-border-bottom-left-radius
:
5px
;
-ms-border-bottom-left-radius
:
5px
;
-khtml-border-bottom-left-radius
:
5px
;
border-bottom-left-radius
:
5px
;
-moz-border-radius-bottomright
:
5px
;
-webkit-border-bottom-right-radius
:
5px
;
-o-border-bottom-right-radius
:
5px
;
-ms-border-bottom-right-radius
:
5px
;
-khtml-border-bottom-right-radius
:
5px
;
border-bottom-right-radius
:
5px
;
background
:
#f4fce8
;
border-top
:
1px
solid
#ededed
;
padding
:
0
20px
;
line-height
:
36px
;
}
/* line 22, /opt/ree/lib/ruby/gems/1.8/gems/compass-0.10.5/frameworks/compass/stylesheets/compass/utilities/general/_clearfix.scss */
#todoapp
#todo-stats
:after
{
content
:
"\0020"
;
display
:
block
;
height
:
0
;
clear
:
both
;
overflow
:
hidden
;
visibility
:
hidden
;
}
/* line 118 */
#todoapp
#todo-stats
.todo-count
{
float
:
left
;
}
/* line 120 */
#todoapp
#todo-stats
.todo-count
.number
{
font-weight
:
bold
;
color
:
#555555
;
}
/* line 123 */
#todoapp
#todo-stats
.todo-clear
{
float
:
right
;
}
/* line 125 */
#todoapp
#todo-stats
.todo-clear
a
{
display
:
block
;
line-height
:
20px
;
text-decoration
:
none
;
-moz-border-radius
:
12px
;
-webkit-border-radius
:
12px
;
-o-border-radius
:
12px
;
-ms-border-radius
:
12px
;
-khtml-border-radius
:
12px
;
border-radius
:
12px
;
background
:
rgba
(
0
,
0
,
0
,
0.1
);
color
:
#555555
;
font-size
:
11px
;
margin-top
:
8px
;
padding
:
0
10px
1px
;
-moz-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
-1px
0
0
;
-webkit-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
-1px
0
0
;
-o-box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
-1px
0
0
;
box-shadow
:
rgba
(
0
,
0
,
0
,
0.2
)
0
-1px
0
0
;
}
/* line 136 */
#todoapp
#todo-stats
.todo-clear
a
:hover
{
background
:
rgba
(
0
,
0
,
0
,
0.15
);
-moz-box-shadow
:
rgba
(
0
,
0
,
0
,
0.3
)
0
-1px
0
0
;
-webkit-box-shadow
:
rgba
(
0
,
0
,
0
,
0.3
)
0
-1px
0
0
;
-o-box-shadow
:
rgba
(
0
,
0
,
0
,
0.3
)
0
-1px
0
0
;
box-shadow
:
rgba
(
0
,
0
,
0
,
0.3
)
0
-1px
0
0
;
}
/* line 139 */
#todoapp
#todo-stats
.todo-clear
a
:active
{
position
:
relative
;
top
:
1px
;
}
todo-example/knockoutjs/index.html
View file @
7c70864f
...
...
@@ -5,7 +5,7 @@
<link
href=
"css/todos.css"
media=
"all"
rel=
"stylesheet"
type=
"text/css"
/>
<script
src=
"js/jquery-1.6.1.js"
type=
"text/javascript"
></script>
<script
src=
"js/jquery.tmpl.js"
type=
"text/javascript"
></script>
<script
src=
"js/knockout-1.2.1.
debug.
js"
type=
"text/javascript"
></script>
<script
src=
"js/knockout-1.2.1.js"
type=
"text/javascript"
></script>
</head>
<body>
<div
id=
"todoapp"
>
...
...
@@ -77,10 +77,18 @@
current
:
ko
.
observable
(),
add
:
function
(
event
)
{
if
(
event
.
keyCode
===
13
)
{
var
newTodo
=
new
Todo
(
this
.
current
());
var
todoContent
=
""
;
/*includes fix for Opera*/
(
viewModel
.
current
()
==
undefined
)
?
todoContent
=
$
(
'
#new-todo
'
).
val
()
:
todoContent
=
viewModel
.
current
();
var
newTodo
=
new
Todo
(
todoContent
);
this
.
todos
.
push
(
newTodo
);
this
.
current
(
""
);
}
},
remove
:
function
(
event
)
{
...
...
@@ -92,6 +100,7 @@
}
};
viewModel
.
remaining
=
ko
.
dependentObservable
(
function
()
{
return
this
.
todos
().
filter
(
function
(
el
)
{
return
el
.
done
()
===
false
;
...
...
todo-example/knockoutjs/js/knockout-1.2.1.js
0 → 100644
View file @
7c70864f
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment