diff options
author | Corey Farwell <coreyf@rwell.org> | 2017-07-26 22:58:19 +0000 |
---|---|---|
committer | Corey Farwell <coreyf@rwell.org> | 2017-07-26 23:44:01 +0000 |
commit | 23e5bfaf27312840092d9938bb99748a02e0d9bf (patch) | |
tree | 6ab3cb8cb26dd1226c5178d7f49fa5eef47f51cb /components/script/dom/htmlelement.rs | |
parent | 58fd2956b339781c963f14eb9edb9ae71858e68b (diff) | |
download | servo-23e5bfaf27312840092d9938bb99748a02e0d9bf.tar.gz servo-23e5bfaf27312840092d9938bb99748a02e0d9bf.zip |
Audit usages of unicode case-changing methods.
Diffstat (limited to 'components/script/dom/htmlelement.rs')
-rw-r--r-- | components/script/dom/htmlelement.rs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/components/script/dom/htmlelement.rs b/components/script/dom/htmlelement.rs index 59846595166..4ff21be028d 100644 --- a/components/script/dom/htmlelement.rs +++ b/components/script/dom/htmlelement.rs @@ -377,9 +377,9 @@ impl HTMLElementMethods for HTMLElement { fn to_snake_case(name: DOMString) -> DOMString { let mut attr_name = "data-".to_owned(); for ch in name.chars() { - if ch.is_uppercase() { + if ch.is_ascii_uppercase() { attr_name.push('\x2d'); - attr_name.extend(ch.to_lowercase()); + attr_name.push(ch.to_ascii_lowercase()); } else { attr_name.push(ch); } @@ -398,9 +398,7 @@ fn to_camel_case(name: &str) -> Option<DOMString> { return None; } let name = &name[5..]; - let has_uppercase = name.chars().any(|curr_char| { - curr_char.is_ascii() && curr_char.is_uppercase() - }); + let has_uppercase = name.chars().any(|curr_char| curr_char.is_ascii_uppercase()); if has_uppercase { return None; } @@ -410,7 +408,7 @@ fn to_camel_case(name: &str) -> Option<DOMString> { //check for hyphen followed by character if curr_char == '\x2d' { if let Some(next_char) = name_chars.next() { - if next_char.is_ascii() && next_char.is_lowercase() { + if next_char.is_ascii_lowercase() { result.push(next_char.to_ascii_uppercase()); } else { result.push(curr_char); |