I am getting warings when I use roadie when I want inline styles. It loops over the stylessheet and inlines the styles for each selector. It also inlines the styles from normalize.css
button:-moz-focusring,
[type="button"]:-moz-focusring,
[type="reset"]:-moz-focusring,
[type="submit"]:-moz-focusring {
outline: 1px dotted ButtonText;
}
I created a little sample script to demonstrate the issue.
require 'nokogiri'
doc = Nokogiri.XML('<foo></foo>')
p doc.send(:css_rules_to_xpath, ['a:hover'], {})
p doc.css('a:hover')
p doc.send(:css_rules_to_xpath, ['div:empty'], {})
p doc.css('div:empty')
p doc.send(:css_rules_to_xpath, ['a:a-moz-drag-over'], {})
p doc.css('a:a-moz-drag-over')
p doc.send(:css_rules_to_xpath, ['a:-moz-drag-over'], {})
p doc.css('a:-moz-drag-over')
output
["//a[nokogiri:hover(.)]"]
[]
["//div[not(node())]"]
[]
["//a[nokogiri:a-moz-drag-over(.)]"]
[]
["//a[nokogiri:-moz-drag-over(.)]"]
/Users/simon/.asdf/installs/ruby/3.2.1/lib/ruby/gems/3.2.0/gems/nokogiri-1.16.5-arm64-darwin/lib/nokogiri/xml/searchable.rb:238:in `evaluate': ERROR: Invalid expression: //a[nokogiri:-moz-drag-over(.)] (Nokogiri::XML::XPath::SyntaxError)
from /Users/simon/.asdf/installs/ruby/3.2.1/lib/ruby/gems/3.2.0/gems/nokogiri-1.16.5-arm64-darwin/lib/nokogiri/xml/searchable.rb:238:in `xpath_impl'
from /Users/simon/.asdf/installs/ruby/3.2.1/lib/ruby/gems/3.2.0/gems/nokogiri-1.16.5-arm64-darwin/lib/nokogiri/xml/searchable.rb:219:in `xpath_internal'
from /Users/simon/.asdf/installs/ruby/3.2.1/lib/ruby/gems/3.2.0/gems/nokogiri-1.16.5-arm64-darwin/lib/nokogiri/xml/searchable.rb:211:in `css_internal'
from /Users/simon/.asdf/installs/ruby/3.2.1/lib/ruby/gems/3.2.0/gems/nokogiri-1.16.5-arm64-darwin/lib/nokogiri/xml/searchable.rb:132:in `css'
from /Users/simon/dev/work/dodo/fakturabank/repo/bb.rb:28:in `<main>'
from /Users/simon/.asdf/installs/ruby/3.2.1/lib/ruby/gems/3.2.0/gems/railties-7.0.8/lib/rails/commands/runner/runner_command.rb:43:in `load'
from /Users/simon/.asdf/installs/ruby/3.2.1/lib/ruby/gems/3.2.0/gems/railties-7.0.8/lib/rails/commands/runner/runner_command.rb:43:in `perform'
from /Users/simon/.asdf/installs/ruby/3.2.1/lib/ruby/gems/3.2.0/gems/thor-1.2.2/lib/thor/command.rb:27:in `run'
from /Users/simon/.asdf/installs/ruby/3.2.1/lib/ruby/gems/3.2.0/gems/thor-1.2.2/lib/thor/invocation.rb:127:in `invoke_command'
from /Users/simon/.asdf/installs/ruby/3.2.1/lib/ruby/gems/3.2.0/gems/thor-1.2.2/lib/thor.rb:392:in `dispatch'
from /Users/simon/.asdf/installs/ruby/3.2.1/lib/ruby/gems/3.2.0/gems/railties-7.0.8/lib/rails/command/base.rb:87:in `perform'
from /Users/simon/.asdf/installs/ruby/3.2.1/lib/ruby/gems/3.2.0/gems/railties-7.0.8/lib/rails/command.rb:48:in `invoke'
from /Users/simon/.asdf/installs/ruby/3.2.1/lib/ruby/gems/3.2.0/gems/railties-7.0.8/lib/rails/commands.rb:18:in `<main>'
from <internal:/Users/simon/.asdf/installs/ruby/3.2.1/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
from <internal:/Users/simon/.asdf/installs/ruby/3.2.1/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
from /Users/simon/.asdf/installs/ruby/3.2.1/lib/ruby/gems/3.2.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
from bin/rails:4:in `<main>'
As you can see it don't crash for a-moz-drag-over which is an unknown pseudo class. Maybe it crashed because it starts on a -. Is this something we can fix or should I try to fix it on the outside?
I am getting warings when I use roadie when I want inline styles. It loops over the stylessheet and inlines the styles for each selector. It also inlines the styles from normalize.css
I created a little sample script to demonstrate the issue.
output
["//a[nokogiri:hover(.)]"] [] ["//div[not(node())]"] [] ["//a[nokogiri:a-moz-drag-over(.)]"] [] ["//a[nokogiri:-moz-drag-over(.)]"] /Users/simon/.asdf/installs/ruby/3.2.1/lib/ruby/gems/3.2.0/gems/nokogiri-1.16.5-arm64-darwin/lib/nokogiri/xml/searchable.rb:238:in `evaluate': ERROR: Invalid expression: //a[nokogiri:-moz-drag-over(.)] (Nokogiri::XML::XPath::SyntaxError) from /Users/simon/.asdf/installs/ruby/3.2.1/lib/ruby/gems/3.2.0/gems/nokogiri-1.16.5-arm64-darwin/lib/nokogiri/xml/searchable.rb:238:in `xpath_impl' from /Users/simon/.asdf/installs/ruby/3.2.1/lib/ruby/gems/3.2.0/gems/nokogiri-1.16.5-arm64-darwin/lib/nokogiri/xml/searchable.rb:219:in `xpath_internal' from /Users/simon/.asdf/installs/ruby/3.2.1/lib/ruby/gems/3.2.0/gems/nokogiri-1.16.5-arm64-darwin/lib/nokogiri/xml/searchable.rb:211:in `css_internal' from /Users/simon/.asdf/installs/ruby/3.2.1/lib/ruby/gems/3.2.0/gems/nokogiri-1.16.5-arm64-darwin/lib/nokogiri/xml/searchable.rb:132:in `css' from /Users/simon/dev/work/dodo/fakturabank/repo/bb.rb:28:in `<main>' from /Users/simon/.asdf/installs/ruby/3.2.1/lib/ruby/gems/3.2.0/gems/railties-7.0.8/lib/rails/commands/runner/runner_command.rb:43:in `load' from /Users/simon/.asdf/installs/ruby/3.2.1/lib/ruby/gems/3.2.0/gems/railties-7.0.8/lib/rails/commands/runner/runner_command.rb:43:in `perform' from /Users/simon/.asdf/installs/ruby/3.2.1/lib/ruby/gems/3.2.0/gems/thor-1.2.2/lib/thor/command.rb:27:in `run' from /Users/simon/.asdf/installs/ruby/3.2.1/lib/ruby/gems/3.2.0/gems/thor-1.2.2/lib/thor/invocation.rb:127:in `invoke_command' from /Users/simon/.asdf/installs/ruby/3.2.1/lib/ruby/gems/3.2.0/gems/thor-1.2.2/lib/thor.rb:392:in `dispatch' from /Users/simon/.asdf/installs/ruby/3.2.1/lib/ruby/gems/3.2.0/gems/railties-7.0.8/lib/rails/command/base.rb:87:in `perform' from /Users/simon/.asdf/installs/ruby/3.2.1/lib/ruby/gems/3.2.0/gems/railties-7.0.8/lib/rails/command.rb:48:in `invoke' from /Users/simon/.asdf/installs/ruby/3.2.1/lib/ruby/gems/3.2.0/gems/railties-7.0.8/lib/rails/commands.rb:18:in `<main>' from <internal:/Users/simon/.asdf/installs/ruby/3.2.1/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require' from <internal:/Users/simon/.asdf/installs/ruby/3.2.1/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require' from /Users/simon/.asdf/installs/ruby/3.2.1/lib/ruby/gems/3.2.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require' from bin/rails:4:in `<main>'As you can see it don't crash for a-moz-drag-over which is an unknown pseudo class. Maybe it crashed because it starts on a
-. Is this something we can fix or should I try to fix it on the outside?