lib/scss_lint/linter/selector_depth.rb in scss-lint-0.14.0 vs lib/scss_lint/linter/selector_depth.rb in scss-lint-0.15.0
- old
+ new
@@ -36,10 +36,12 @@
def sequence_depth(sequence, current_depth)
separators, simple_sequences = sequence.members.partition do |item|
item.is_a?(String)
end
- parent_selectors = simple_sequences.count { |item| item.to_s == '&' }
+ parent_selectors = simple_sequences.count do |item|
+ item.rest.any? { |i| i.is_a?(Sass::Selector::Parent) }
+ end
# Take the number of simple sequences and subtract one for each sibling
# combinator, as these "combine" simple sequences such that they do not
# increase depth.
depth = simple_sequences.size -