diff options
-rw-r--r-- | components/style/gecko/selector_parser.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/components/style/gecko/selector_parser.rs b/components/style/gecko/selector_parser.rs index e87336669d5..95b7ab82ac5 100644 --- a/components/style/gecko/selector_parser.rs +++ b/components/style/gecko/selector_parser.rs @@ -235,8 +235,12 @@ impl ToCss for NonTSPseudoClass { $(NonTSPseudoClass::$s_name(ref s) => { write!(dest, ":{}(", $s_css)?; { + // FIXME(emilio): Avoid the extra allocation! let mut css = CssStringWriter::new(dest); - css.write_str(&String::from_utf16(&s).unwrap())?; + + // Discount the null char in the end from the + // string. + css.write_str(&String::from_utf16(&s[..s.len() - 1]).unwrap())?; } return dest.write_str(")") }, )* |