Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
grosser committed Apr 6, 2024
1 parent 951fa17 commit 45155dc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
6 changes: 3 additions & 3 deletions lib/css_parser.rb
Expand Up @@ -75,13 +75,13 @@ def self.merge(*rule_sets)

rule_set.each_declaration do |property, value, is_important|
# Add the property to the list to be folded per http://www.w3.org/TR/CSS21/cascade.html#cascading-order
if not properties.key?(property)
if !properties.key?(property)
properties[property] = {value: value, specificity: specificity, is_important: is_important}
elsif is_important
if not properties[property][:is_important] or properties[property][:specificity] <= specificity
if !properties[property][:is_important] || properties[property][:specificity] <= specificity
properties[property] = {value: value, specificity: specificity, is_important: is_important}
end
elsif properties[property][:specificity] < specificity or properties[property][:specificity] == specificity
elsif properties[property][:specificity] < specificity || properties[property][:specificity] == specificity
unless properties[property][:is_important]
properties[property] = {value: value, specificity: specificity, is_important: is_important}
end
Expand Down
14 changes: 8 additions & 6 deletions lib/css_parser/parser.rb
Expand Up @@ -35,12 +35,14 @@ class Parser
class << self; attr_reader :folded_declaration_cache; end

def initialize(options = {})
@options = {absolute_paths: false,
import: true,
io_exceptions: true,
rule_set_exceptions: true,
capture_offsets: false,
user_agent: USER_AGENT}.merge(options)
@options = {
absolute_paths: false,
import: true,
io_exceptions: true,
rule_set_exceptions: true,
capture_offsets: false,
user_agent: USER_AGENT
}.merge(options)

# array of RuleSets
@rules = []
Expand Down

0 comments on commit 45155dc

Please sign in to comment.