Skip to content

Commit

Permalink
Used custom_properties::parse_name
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan Jeffrey committed Jul 28, 2017
1 parent 7e6fd29 commit b9a699f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions components/script/dom/stylepropertymapreadonly.rs
Expand Up @@ -16,6 +16,7 @@ use servo_atoms::Atom;
use std::cmp::Ordering;
use std::collections::HashMap;
use std::iter::Iterator;
use style::custom_properties;

#[dom_struct]
pub struct StylePropertyMapReadOnly {
Expand Down Expand Up @@ -73,14 +74,14 @@ impl StylePropertyMapReadOnlyMethods for StylePropertyMapReadOnly {
// https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-getproperties
// requires this sort order
result.sort_by(|key1, key2| {
if key1.starts_with("-") {
if key2.starts_with("-") {
if let Ok(key1) = custom_properties::parse_name(key1) {
if let Ok(key2) = custom_properties::parse_name(key2) {
key1.cmp(key2)
} else {
Ordering::Greater
}
} else {
if key2.starts_with("-") {
if let Ok(_) = custom_properties::parse_name(key2) {
Ordering::Less
} else {
key1.cmp(key2)
Expand Down

0 comments on commit b9a699f

Please sign in to comment.