Skip to content

Commit

Permalink
Follow the First Law of Extend (see #324).
Browse files Browse the repository at this point in the history
Some tests still fail, since they rely on the old behavior which violated this
law.
  • Loading branch information
nex3 committed Mar 28, 2012
1 parent 6ec598e commit fd62fb5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/sass/selector/comma_sequence.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,15 @@ def resolve_parent_refs(super_cseq)
# @return [CommaSequence] A copy of this selector,
# with extensions made according to `extends`
def do_extend(extends)
CommaSequence.new(members.map {|seq| seq.do_extend(extends)}.flatten)
CommaSequence.new(members.map do |seq|
extended = seq.do_extend(extends)
# First Law of Extend: the result of extending a selector should
# always contain the base selector.
#
# See https://github.com/nex3/sass/issues/324.
extended.unshift seq unless seq.has_placeholder? || extended.include?(seq)
extended
end.flatten)
end

# Returns a string representation of the sequence.
Expand Down

0 comments on commit fd62fb5

Please sign in to comment.