Skip to content

Commit

Permalink
escape quotes in selector tag names during canonicalization
Browse files Browse the repository at this point in the history
  • Loading branch information
antonok-edm committed Aug 6, 2024
1 parent 11e3f82 commit d25b1f4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/filters/cosmetic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -791,11 +791,11 @@ mod css_validation {
type ExtraMatchingData = ();
type AttrValue = CssString;
type Identifier = CssIdent;
type LocalName = DummyValue;
type LocalName = CssString;
type NamespaceUrl = DummyValue;
type NamespacePrefix = DummyValue;
type BorrowedNamespaceUrl = DummyValue;
type BorrowedLocalName = DummyValue;
type BorrowedLocalName = CssString;
type NonTSPseudoClass = NonTSPseudoClass;
type PseudoElement = PseudoElement;
}
Expand Down Expand Up @@ -915,6 +915,11 @@ mod css_validation {
// opening comment to match it.
assert!(validate_css_selector(r#"input[x="*/{}*{background:url(https://hackvertor.co.uk/images/logo.gif)}"]"#, false).is_some());
}

#[test]
fn escaped_quote_in_tag_name() {
assert_eq!(validate_css_selector(r#"head\""#, false), Some(r#"head\""#.to_string()));
}
}

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

0 comments on commit d25b1f4

Please sign in to comment.