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
Sven Franck
todomvc
Commits
3abb0607
Commit
3abb0607
authored
Jan 16, 2013
by
Pascal Hartig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dart: Escape HTML in todo rendering
parent
eec36343
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
2 deletions
+15
-2
architecture-examples/dart/web/dart/TodoWidget.dart
architecture-examples/dart/web/dart/TodoWidget.dart
+2
-2
architecture-examples/dart/web/dart/app.dart
architecture-examples/dart/web/dart/app.dart
+13
-0
No files found.
architecture-examples/dart/web/dart/TodoWidget.dart
View file @
3abb0607
...
...
@@ -13,10 +13,10 @@ class TodoWidget {
<li
${todo.completed ? 'class="completed"' : ''}
>
<div class='
view
'>
<input class='
toggle
' type='
checkbox
'
${todo.completed ? 'checked' : ''}
>
<label class='
todo
-
content
'>
${
todo.title
}
</label>
<label class='
todo
-
content
'>
${
htmlEscape(todo.title)
}
</label>
<button class='
destroy
'></button>
</div>
<input class='
edit
' value='
$
{
todo
.
title
}
'>
<input class='
edit
' value='
$
{
htmlEscape
(
todo
.
title
)
}
'>
</li>
'''
);
...
...
architecture-examples/dart/web/dart/app.dart
View file @
3abb0607
...
...
@@ -40,3 +40,16 @@ class UUID {
return
random
.
nextInt
(
65536
).
toRadixString
(
16
);
}
}
/**
* Escapes HTML-special characters of [text] so that the result can be
* included verbatim in HTML source code, either in an element body or in an
* attribute value.
*/
String
htmlEscape
(
String
text
)
{
return
text
.
replaceAll
(
"&"
,
"&"
)
.
replaceAll
(
"<"
,
"<"
)
.
replaceAll
(
">"
,
">"
)
.
replaceAll
(
'"'
,
"""
)
.
replaceAll
(
"'"
,
"'"
);
}
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