File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -941,7 +941,7 @@ impl QueryStyleRange {
941941 QueryExpressionValue :: Custom ( ident) => {
942942 // `ident` is the dashed ident, but we need the name
943943 // without "--" for custom-property lookup.
944- let name = Atom :: from ( & ident. 0 . as_slice ( ) [ 2 .. ] ) ;
944+ let name = ident. undashed ( ) ;
945945 let stylist = context
946946 . builder
947947 . stylist
Original file line number Diff line number Diff line change @@ -646,6 +646,20 @@ impl DashedIdent {
646646 pub fn is_empty ( & self ) -> bool {
647647 self . 0 == atom ! ( "" )
648648 }
649+
650+ /// Returns an atom with the same value, but without the starting "--".
651+ ///
652+ /// # Panics
653+ ///
654+ /// Panics when used on the special `DashedIdent::empty()`.
655+ pub ( crate ) fn undashed ( & self ) -> Atom {
656+ assert ! ( !self . is_empty( ) , "Can't undash the empty DashedIdent" ) ;
657+ #[ cfg( feature = "gecko" ) ]
658+ let name = & self . 0 . as_slice ( ) [ 2 ..] ;
659+ #[ cfg( feature = "servo" ) ]
660+ let name = & self . 0 [ 2 ..] ;
661+ Atom :: from ( name)
662+ }
649663}
650664
651665impl Parse for DashedIdent {
You can’t perform that action at this time.
0 commit comments