class Sass::Selector::Sequence
def merge_initial_ops(seq1, seq2)
-
(Array
- If there are no operators in the merged, nil)
Parameters:
-
seq2
(Array
) -- -
seq1
(Array
) --
def merge_initial_ops(seq1, seq2) ops1, ops2 = [], [] ops1 << seq1.shift while seq1.first.is_a?(String) ops2 << seq2.shift while seq2.first.is_a?(String) newline = false newline ||= !!ops1.shift if ops1.first == "\n" newline ||= !!ops2.shift if ops2.first == "\n" # If neither sequence is a subsequence of the other, they cannot be # merged successfully lcs = Sass::Util.lcs(ops1, ops2) return unless lcs == ops1 || lcs == ops2 (newline ? ["\n"] : []) + (ops1.size > ops2.size ? ops1 : ops2) end