lib/sass/tree/rule_node.rb in sass-3.1.0.alpha.25 vs lib/sass/tree/rule_node.rb in sass-3.1.0.alpha.26
- old
+ new
@@ -51,15 +51,12 @@
attr_accessor :group_end
# @param rule [Array<String, Sass::Script::Node>]
# The CSS rule. See \{#rule}
def initialize(rule)
- #p rule
merged = Sass::Util.merge_adjacent_strings(rule)
- #p merged
@rule = Sass::Util.strip_string_array(merged)
- #p @rule
@tabs = 0
super()
end
# Compares the contents of two rules.
@@ -198,12 +195,12 @@
# The extensions defined for this tree
# @param parent [RuleNode, nil] The parent node of this node,
# or nil if the parent isn't a {RuleNode}
def _cssize(extends, parent)
node = super
- rules = node.children.grep(RuleNode)
- props = node.children.reject {|c| c.is_a?(RuleNode) || c.invisible?}
+ rules = node.children.select {|c| c.is_a?(RuleNode) || c.is_a?(MediaNode)}
+ props = node.children.reject {|c| c.is_a?(RuleNode) || c.is_a?(MediaNode) || c.invisible?}
unless props.empty?
node.children = props
rules.each {|r| r.tabs += 1} if style == :nested
rules.unshift(node)
@@ -221,10 +218,11 @@
# The extensions defined for this tree
# @param parent [RuleNode, nil] The parent node of this node,
# or nil if the parent isn't a {RuleNode}
# @raise [Sass::SyntaxError] if the rule has no parents but uses `&`
def cssize!(extends, parent)
- self.resolved_rules = @parsed_rules.resolve_parent_refs(parent && parent.resolved_rules)
+ # It's possible for resolved_rules to be set if we've duplicated this node during @media bubbling
+ self.resolved_rules ||= @parsed_rules.resolve_parent_refs(parent && parent.resolved_rules)
super
end
# Returns an error message if the given child node is invalid,
# and false otherwise.