From 2cb51477d21b5f0f8bcdfe91e5716c9cd7f83620 Mon Sep 17 00:00:00 2001 From: Sunshine Date: Mon, 24 May 2021 01:47:19 -1000 Subject: [PATCH 1/2] add Monk to related projects in README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 8d07184..fbd552b 100644 --- a/README.md +++ b/README.md @@ -103,6 +103,7 @@ Please open an issue if something is wrong, that helps make this project better. - `Pagesaver`: https://github.com/distributed-mind/pagesaver - `Personal WayBack Machine`: https://github.com/popey/pwbm - `Hako`: https://github.com/dmpop/hako + - `Monk`: https://gitlab.com/fisherdarling/monk --------------------------------------------------- From 2369a4dd3c03f3b2ea94ebff07c252102ed2565a Mon Sep 17 00:00:00 2001 From: Sunshine Date: Fri, 28 May 2021 12:03:19 -1000 Subject: [PATCH 2/2] remove optional trailing space from CSS idents --- src/css.rs | 1 + src/tests/css/embed_css.rs | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/src/css.rs b/src/css.rs index a1205a9..24047d0 100644 --- a/src/css.rs +++ b/src/css.rs @@ -66,6 +66,7 @@ pub fn enquote(input: String, double: bool) -> String { pub fn format_ident(ident: &str) -> String { let mut res: String = String::new(); let _ = serialize_identifier(ident, &mut res); + res = res.trim_end().to_string(); res } diff --git a/src/tests/css/embed_css.rs b/src/tests/css/embed_css.rs index bd51b2c..555f217 100644 --- a/src/tests/css/embed_css.rs +++ b/src/tests/css/embed_css.rs @@ -340,4 +340,31 @@ mod passing { CSS_OUT ); } + + #[test] + fn ie_css_hack() { + let cache = &mut HashMap::new(); + let client = Client::new(); + let document_url: Url = Url::parse("data:,").unwrap(); + let mut options = Options::default(); + options.silent = true; + + const CSS: &str = "\ + div#p>svg>foreignObject>section:not(\\9) {\n\ + width: 300px;\n\ + width: 500px\\9;\n\ + }\n\ + "; + const CSS_OUT: &str = "\ + div#p>svg>foreignObject>section:not(\\9) {\n\ + width: 300px;\n\ + width: 500px\t;\n\ + }\n\ + "; + + assert_eq!( + css::embed_css(cache, &client, &document_url, &CSS, &options, 0,), + CSS_OUT + ); + } }