|
1 | 1 | //! CSS declarations. |
2 | 2 |
|
3 | 3 | use std::borrow::Cow; |
4 | | -use std::collections::HashMap; |
5 | 4 | use std::ops::Range; |
6 | 5 |
|
7 | 6 | use crate::context::{DeclarationContext, PropertyHandlerContext}; |
@@ -41,6 +40,7 @@ use crate::values::string::CowArcStr; |
41 | 40 | #[cfg(feature = "visitor")] |
42 | 41 | use crate::visitor::Visit; |
43 | 42 | use cssparser::*; |
| 43 | +use indexmap::IndexMap; |
44 | 44 |
|
45 | 45 | /// A CSS declaration block. |
46 | 46 | /// |
@@ -518,7 +518,7 @@ pub(crate) struct DeclarationHandler<'i> { |
518 | 518 | prefix: PrefixHandler, |
519 | 519 | direction: Option<Direction>, |
520 | 520 | unicode_bidi: Option<UnicodeBidi>, |
521 | | - custom_properties: HashMap<DashedIdent<'i>, usize>, |
| 521 | + custom_properties: IndexMap<DashedIdent<'i>, usize>, |
522 | 522 | decls: DeclarationList<'i>, |
523 | 523 | } |
524 | 524 |
|
@@ -609,7 +609,7 @@ impl<'i> DeclarationHandler<'i> { |
609 | 609 | direction: self.direction.clone(), |
610 | 610 | ..Default::default() |
611 | 611 | }; |
612 | | - for (key, index) in self.custom_properties.drain() { |
| 612 | + for (key, index) in self.custom_properties.drain(..) { |
613 | 613 | handler.custom_properties.insert(key, handler.decls.len()); |
614 | 614 | handler.decls.push(self.decls[index].clone()); |
615 | 615 | } |
|
0 commit comments