Skip to content

Commit

Permalink
Don't print selectors with multiple subjects created via @extend.
Browse files Browse the repository at this point in the history
  • Loading branch information
nex3 committed Jun 30, 2012
1 parent a0b6e45 commit 8acd945
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/sass/selector/sequence.rb
Expand Up @@ -197,7 +197,7 @@ def subweave(seq1, seq2)
diff += fin.map {|sel| sel.is_a?(Array) ? sel : [sel]}
diff.reject! {|c| c.empty?}

Sass::Util.paths(diff).map {|p| p.flatten}
Sass::Util.paths(diff).map {|p| p.flatten}.reject {|p| path_has_two_subjects?(p)}
end

# Extracts initial selector combinators (`"+"`, `">"`, `"~"`, and `"\n"`)
Expand Down Expand Up @@ -466,6 +466,17 @@ def _eql?(other)

private

def path_has_two_subjects?(path)
subject = false
path.each do |sseq_or_op|
next unless sseq_or_op.is_a?(SimpleSequence)
next unless sseq_or_op.subject?
return true if subject
subject = true
end
false
end

def _sources(seq)
s = Set.new
seq.map {|sseq_or_op| s.merge sseq_or_op.sources if sseq_or_op.is_a?(SimpleSequence)}
Expand Down

0 comments on commit 8acd945

Please sign in to comment.