From ae77e8a32c4fa87020ca8a354c68412e7a1fb63d Mon Sep 17 00:00:00 2001 From: asgerb Date: Tue, 6 Feb 2024 12:25:32 +0100 Subject: [PATCH 1/4] fix: don't strip root pseudo-class --- lib/roadie/selector.rb | 1 + spec/integration_spec.rb | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/lib/roadie/selector.rb b/lib/roadie/selector.rb index 895a98e..7503f20 100644 --- a/lib/roadie/selector.rb +++ b/lib/roadie/selector.rb @@ -71,6 +71,7 @@ def ==(other) :before :after :enabled :disabled :checked :host + :root ].freeze def pseudo_element? diff --git a/spec/integration_spec.rb b/spec/integration_spec.rb index f2f583f..fc458fe 100644 --- a/spec/integration_spec.rb +++ b/spec/integration_spec.rb @@ -67,6 +67,29 @@ def parse_html(html) expect(styles).to include Roadie::Stylesheet.new("", css).to_s end + it "does not strip :root pseudo-class" do + document = Roadie::Document.new <<-HTML + + + Hello world! + + +

Hello world!

+ + + HTML + css = <<-CSS + :root { --color: red; } + CSS + document.add_css css + + result = parse_html document.transform + expect(result).to have_selector("html > head > style") + + styles = result.at_css("html > head > style").text + expect(styles).to include Roadie::Stylesheet.new("", css).to_s + end + it "can be configured to skip styles that cannot be inlined" do document = Roadie::Document.new <<-HTML From 6418ec9805d9a8e1085c886b6ab8faaeebff2633 Mon Sep 17 00:00:00 2001 From: asgerb Date: Wed, 7 Feb 2024 13:32:51 +0100 Subject: [PATCH 2/4] chore: add changelog entry --- Changelog.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Changelog.md b/Changelog.md index 4e126ce..345c696 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,6 +2,8 @@ [full changelog](https://github.com/Mange/roadie/compare/v5.2.0...master) +* Don't strip `:root` pseudo-class - [Asger Behncke](https://github.com/asgerb) (#173) + ### 5.2.0 [full changelog](https://github.com/Mange/roadie/compare/v5.1.0...v5.2.0) From 547cb1aa7bcdb6ab416feda7c9ffc73fe467be5e Mon Sep 17 00:00:00 2001 From: asgerb Date: Wed, 7 Feb 2024 13:33:40 +0100 Subject: [PATCH 3/4] chore: update CHANGELOG entry --- Changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index 345c696..52bbb54 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,7 +2,7 @@ [full changelog](https://github.com/Mange/roadie/compare/v5.2.0...master) -* Don't strip `:root` pseudo-class - [Asger Behncke](https://github.com/asgerb) (#173) +* Don't strip the [`:root` pseudo-class](https://developer.mozilla.org/en-US/docs/Web/CSS/:root) - [Asger Behncke](https://github.com/asgerb) (#173) ### 5.2.0 From 7189178323010a555777c6d5c08dd5b33e5a87cc Mon Sep 17 00:00:00 2001 From: asgerb Date: Wed, 7 Feb 2024 13:33:58 +0100 Subject: [PATCH 4/4] chore: full name --- Changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index 52bbb54..ca7e0c4 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,7 +2,7 @@ [full changelog](https://github.com/Mange/roadie/compare/v5.2.0...master) -* Don't strip the [`:root` pseudo-class](https://developer.mozilla.org/en-US/docs/Web/CSS/:root) - [Asger Behncke](https://github.com/asgerb) (#173) +* Don't strip the [`:root` pseudo-class](https://developer.mozilla.org/en-US/docs/Web/CSS/:root) - [Asger Behncke Jacobsen](https://github.com/asgerb) (#173) ### 5.2.0