Skip to content

Commit d25b1f4

Browse files
committed
escape quotes in selector tag names during canonicalization
1 parent 11e3f82 commit d25b1f4

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/filters/cosmetic.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -791,11 +791,11 @@ mod css_validation {
791791
type ExtraMatchingData = ();
792792
type AttrValue = CssString;
793793
type Identifier = CssIdent;
794-
type LocalName = DummyValue;
794+
type LocalName = CssString;
795795
type NamespaceUrl = DummyValue;
796796
type NamespacePrefix = DummyValue;
797797
type BorrowedNamespaceUrl = DummyValue;
798-
type BorrowedLocalName = DummyValue;
798+
type BorrowedLocalName = CssString;
799799
type NonTSPseudoClass = NonTSPseudoClass;
800800
type PseudoElement = PseudoElement;
801801
}
@@ -915,6 +915,11 @@ mod css_validation {
915915
// opening comment to match it.
916916
assert!(validate_css_selector(r#"input[x="*/{}*{background:url(https://hackvertor.co.uk/images/logo.gif)}"]"#, false).is_some());
917917
}
918+
919+
#[test]
920+
fn escaped_quote_in_tag_name() {
921+
assert_eq!(validate_css_selector(r#"head\""#, false), Some(r#"head\""#.to_string()));
922+
}
918923
}
919924

920925
static RE_PLAIN_SELECTOR: Lazy<Regex> = Lazy::new(|| Regex::new(r"^[#.][\w\\-]+").unwrap());

0 commit comments

Comments
 (0)