Chromium Code Reviews| Index: sdk/lib/convert/html.dart |
| diff --git a/sdk/lib/convert/html.dart b/sdk/lib/convert/html.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..88474725a5fa6e64cc725f47b928548b534bc95b |
| --- /dev/null |
| +++ b/sdk/lib/convert/html.dart |
| @@ -0,0 +1,20 @@ |
| +// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| +// for details. All rights reserved. Use of this source code is governed by a |
| +// BSD-style license that can be found in the LICENSE file. |
| + |
| +part of dart.convert; |
| + |
| +const HTML_ESCAPE = const HtmlEscape(); |
| + |
| +class HtmlEscape extends Converter<String, String> { |
| + |
| + const HtmlEscape(); |
| + |
| + String convert(String data) { |
|
Jennifer Messerly
2013/08/26 23:01:28
I wonder if this impl should be based on HTML5 spe
Lasse Reichstein Nielsen
2013/08/27 06:07:40
We could have different escapes for different cont
Jennifer Messerly
2013/08/27 18:26:17
Using an enum for context SGTM. For attribute cont
|
| + return data.replaceAll("&", "&") |
| + .replaceAll("<", "<") |
| + .replaceAll(">", ">") |
| + .replaceAll('"', """) |
| + .replaceAll("'", "'"); |
|
Lasse Reichstein Nielsen
2013/08/27 06:07:40
This is horribly inefficient. It's ok as a first g
Jennifer Messerly
2013/08/27 18:26:17
+1
kevmoo-old
2013/08/27 20:52:23
Done.
kevmoo-old
2013/08/27 20:52:23
Done.
|
| + } |
| +} |