diff --git a/CHANGELOG.md b/CHANGELOG.md index 55cbef0..87c2a87 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ### Unreleased +* Minor performance improvements + ### Version v1.21.0 * Minor performance improvements diff --git a/lib/css_parser/parser.rb b/lib/css_parser/parser.rb index 3ee7e4f..57d3a5e 100644 --- a/lib/css_parser/parser.rb +++ b/lib/css_parser/parser.rb @@ -448,7 +448,7 @@ def parse_block_into_rule_sets!(block, options = {}) # :nodoc: current_media_query << token << ' ' end end - elsif in_charset or token =~ /@charset/i + elsif in_charset or /@charset/i.match?(token) # iterate until we are out of the charset declaration in_charset = !token.include?(';') elsif !in_string && token.include?('}') @@ -467,7 +467,7 @@ def parse_block_into_rule_sets!(block, options = {}) # :nodoc: current_selectors << token # mark this as the beginning of the selector unless we have already marked it - rule_start = start_offset if options[:capture_offsets] && rule_start.nil? && token =~ /^[^\s]+$/ + rule_start = start_offset if options[:capture_offsets] && rule_start.nil? && /^[^\s]+$/.match?(token) end end