aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/util/str.rs
diff options
context:
space:
mode:
authorJunyoung Cho <june0.cho@samsung.com>2014-02-21 21:20:48 +0900
committerJunyoung Cho <june0.cho@samsung.com>2014-02-21 21:20:48 +0900
commitab589403ed5c6c5f3c5e8d0c28bb5cb15f738f4b (patch)
tree8962976696938f39b2a3c71bce5ecd87634de743 /src/components/util/str.rs
parent327e1e20a91fe1849ab84a2f0e710e3d4d94aba4 (diff)
downloadservo-ab589403ed5c6c5f3c5e8d0c28bb5cb15f738f4b.tar.gz
servo-ab589403ed5c6c5f3c5e8d0c28bb5cb15f738f4b.zip
Fix: whitespace is considered as spaces(U+0020), tabs(U+0009), and line breaks(U+000D U+000A)
Diffstat (limited to 'src/components/util/str.rs')
-rw-r--r--src/components/util/str.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/components/util/str.rs b/src/components/util/str.rs
index 0b9bd74f074..6010ef69636 100644
--- a/src/components/util/str.rs
+++ b/src/components/util/str.rs
@@ -19,6 +19,9 @@ pub fn null_str_as_empty_ref<'a>(s: &'a Option<DOMString>) -> &'a str {
}
}
-pub fn is_whitespace_not_nbsp(s: &str) -> bool {
- s.chars().all(|c| c.is_whitespace() && c != '\xa0')
+pub fn is_whitespace(s: &str) -> bool {
+ s.chars().all(|c| match c {
+ '\u0020' | '\u0009' | '\u000D' | '\u000A' => true,
+ _ => false
+ })
}