lib/sass/selector/sequence.rb
# Given two sequences of simple selectors, returns whether `sseq1` is a
# superselector of `sseq2`.
#
# @param sseq1 [Array<SimpleSelector or String>]
# @param sseq2 [Array<SimpleSelector or String>]
# @return [Boolean]
Given two sequences of simple selectors, returns whether `sseq1` is a
superselector of `sseq2`.
Given two sequences of simple selectors returns whether ` sseq1 ` is a superselector of ` sseq2 ` .
def subweave_superselector?(sseq1, sseq2)
        if sseq1.size > 1
          return unless sseq2.size > 1
          return unless sseq1[1] == "~" ? sseq2[1] != ">" : sseq2[1] == sseq1[1]
          return unless sseq1.first.superselector?(sseq2.first)
          return true if sseq1.size == 2
          return false if sseq2.size == 2
          return subweave_superselector?(sseq1[2..-1], sseq2[2..-1])
        elsif sseq2.size > 1
          return true if sseq2[1] == ">" && sseq1.first.superselector?(sseq2.first)
          return false if sseq2.size == 2
          return subweave_superselector?(sseq1, sseq2[2..-1])
        else
          sseq1.first.superselector?(sseq2.first)
        end
      end
def subweave_superselector? ( sseq1 , sseq2 ) if sseq1 . size > 1 return unless sseq2 . size > 1 return unless sseq1 [ 1 ] == "~" ? sseq2 [ 1 ] != ">" : sseq2 [ 1 ] == sseq1 [ 1 ] return unless sseq1 . first . superselector? ( sseq2 . first ) return true if sseq1 . size == 2 return false if sseq2 . size == 2 return subweave_superselector? ( sseq1 [ 2 .. - 1 ] , sseq2 [ 2 .. - 1 ] ) elsif sseq2 . size > 1 return true if sseq2 [ 1 ] == ">" && sseq1 . first . superselector? ( sseq2 . first ) return false if sseq2 . size == 2 return subweave_superselector? ( sseq1 , sseq2 [ 2 .. - 1 ] ) else sseq1 . first . superselector? ( sseq2 . first ) end end
Given two sequences of simple selectors, returns whether `sseq1` is a
superselector of `sseq2`.
Given two sequences of simple selectors returns whether ` sseq1 ` is a superselector of ` sseq2 ` .
# More complex selectors are never superselectors of less complex ones # .foo ~ .bar is a superselector of .foo + .bar
None
Boolean
sseq1
sseq2
None