| Class | Sass::Selector::CommaSequence |
| In: |
lib/sass/selector/comma_sequence.rb
|
| Parent: | AbstractSequence |
A comma-separated sequence of selectors.
| members | [R] |
The comma-separated selector sequences represented by this class.
@return [Array<Sequence>] |
Non-destrucively extends this selector with the extensions specified in a hash (which should be populated via {Sass::Tree::Node#cssize}).
@todo Link this to the reference documentation on `@extend`
when such a thing exists.
@param extends [Haml::Util::SubsetMap{Selector::Simple => Selector::Sequence}]
The extensions to perform on this selector
@return [CommaSequence] A copy of this selector,
with extensions made according to `extends`
# File lib/sass/selector/comma_sequence.rb, line 52
52: def do_extend(extends)
53: CommaSequence.new(members.map {|seq| seq.do_extend(extends)}.flatten)
54: end
Returns a string representation of the sequence. This is basically the selector string.
@return [String]
# File lib/sass/selector/comma_sequence.rb, line 60
60: def inspect
61: members.map {|m| m.inspect}.join(", ")
62: end
Resolves the {Parent} selectors within this selector by replacing them with the given parent selector, handling commas appropriately.
@param super_cseq [CommaSequence] The parent selector @return [CommaSequence] This selector, with parent references resolved @raise [Sass::SyntaxError] If a parent selector is invalid
# File lib/sass/selector/comma_sequence.rb, line 23
23: def resolve_parent_refs(super_cseq)
24: if super_cseq.nil?
25: if @members.any? do |sel|
26: sel.members.any? do |sel_or_op|
27: sel_or_op.is_a?(SimpleSequence) && sel_or_op.members.any? {|ssel| ssel.is_a?(Parent)}
28: end
29: end
30: raise Sass::SyntaxError.new("Base-level rules cannot contain the parent-selector-referencing character '&'.")
31: end
32: return self
33: end
34:
35: CommaSequence.new(
36: super_cseq.members.map do |super_seq|
37: @members.map {|seq| seq.resolve_parent_refs(super_seq)}
38: end.flatten)
39: end